Skip to content

Apparent performance regression #2071

@emeneker38a

Description

@emeneker38a

Commit 44e9085 appears to have introduced a performance regression when compared with v25.05.
The performance regression is present in the current master branch.

Attached is a simple benchmark I used to measure the performance difference between libpcap and the current pcapplusplus.

Platform details

((v25.05))> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy
  • GCC version: gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04.2)
  • libpcap version: 1.10.1

Build and comparison

Performance between the master branch and the v25.05 tag were compared by building

cmake -DCMAKE_INSTALL_PREFIX=(realpath ~/local_install/pcapplusplus/) -DPCAPPP_BUILD_EXAMPLES=ON -B build .
cd build
make
make install

g++ -O2 benchmark.cpp -o benchmark -I ~/local_install/pcapplusplus/include/pcapplusplus -L ~/local_install/pcapplusplus/lib/ -lPcap++ -lPacket++ -lCommon++ -lpcap -lpthread

Performance comparison

Regressed performance beginning in commit 44e9085

Running libpcap benchmark:
Benchmarking PCAP file with libpcap: pcap/file.pcap
Reading all packets...

=== libpcap Benchmark Results ===
Packets read: 485760
Total bytes: 232226544 bytes (221.47 MB)
Time taken: 0.077176 seconds
Packets/second: 6294184.72
Throughput: 2869.65 MB/s

--------------------------------------------------

Running PcapPlusPlus benchmark:

=== PcapPlusPlus Benchmark Results ===
Packets read: 485760
Total bytes: 232226544 bytes (221.47 MB)
Time taken: 1.857491 seconds
Packets/second: **261514.05**
Throughput: **119.23 MB/s**

High performance in v25.05

Running libpcap benchmark:
Benchmarking PCAP file with libpcap: pcap/file.pcap
Reading all packets...

=== libpcap Benchmark Results ===
Packets read: 485760
Total bytes: 232226544 bytes (221.47 MB)
Time taken: 0.065889 seconds
Packets/second: 7372399.03
Throughput: 3361.24 MB/s

--------------------------------------------------

Running PcapPlusPlus benchmark:
=== PcapPlusPlus Benchmark Results === 
Packets read: 485760
Total bytes: 232226544 bytes (221.47 MB)
Time taken: 0.084271 seconds
Packets/second: 5764260.54
Throughput: 2628.05 MB/s

The attached benchmark.cpp is 80% Claude Sonnet written.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions