Skip to main content
Version: v25.05

Benchmarks

To evaluate the performance of PcapPlusPlus, we employed two benchmarking methods: comparing it to similar libraries and using Google Benchmark to measure key features. This page presents the results of these tests.

Testing environment​

The benchmarks were conducted on the following system configuration:

  • Linux Ubuntu 22.04 64-bit running inside WSL2
  • g++ 11.4.0
  • The host platform is a Windows machine with Intel Core i7-8700 3.2GHz processor and 16GB RAM running Windows 10

Project Comparison​

To compare PcapPlusPlus with other C++ libraries, we used Matias Fontanini's packet-capture-benchmarks project. This benchmark compares PcapPlusPlus with libtins and libpcap.

PcapPlusPlus was only compared to similar C/C++ projects, as libraries written in higher-level languages (such as Python or Java) cannot match the performance of native C++ libraries.

The following versions were used during the benchmark:

Benchmark #1 - TCP parsing​

LibraryTime taken (seconds)Packets per second
libpcap0.124166666
PcapPlusPlus0.1972538071
libtins0.2092392344
Loading Chart

Benchmark #2 - TCP + TCP Options parsing​

LibraryTime taken (seconds)Packets per second
libpcap0.1244032258
PcapPlusPlus0.2022475247
libtins0.2412074688
Loading Chart

Benchmark #3 - DNS parsing​

LibraryTime taken (seconds)Packets per second
libpcap0.03116129032
PcapPlusPlus0.2082403846
libtins0.2631901140
Loading Chart

Google Benchmark​

Google Benchmark is a library designed for measuring the performance of C++ applications. We utilized it to evaluate several aspects of PcapPlusPlus. The benchmark code can be found in PcapPlusPlus Examples - Google Benchmark.

The benchmark covers the following operations:

  • Reading pcap files (BM_PcapFileRead)
  • Writing pcap files (BM_PcapFileWrite)
  • Packet parsing (BM_PacketCrafting)
  • Packet crafting (BM_PacketCrafting)
BenchmarkTimeCPUIterationsBytes Per SecondItems Per Second
BM_PcapFileRead177 ns177 ns38282892.35172Gi/s5.63843M/s
BM_PcapFileWrite79.1 ns79.1 ns9080461650.828Mi/s12.6378M/s
BM_PacketParsing352 ns352 ns19948051.18917Gi/s2.84116M/s
BM_PacketCrafting385 ns385 ns1799083143.504Mi/s2.59444M/s