Benchmarks

In order to benchmark the performance of PcapPlusPlus and compare it with similar C++ libraries we used Matias Fontanini’s packet-capture-benchmarks project. The benchmark compared PcapPlusPlus, libtins, libcrafter and libpcap.

Table of contents

  1. Tested projects
  2. Testing environment
  3. Test results
    1. Benchmark #1 - TCP parsing
    2. Benchmark #2 - TCP + TCP Options parsing
    3. Benchmark #3 - DNS parsing

Tested projects

PcapPlusPlus was only compared to similar C/C++ projects such as libtins and libcrafter because projects written higher level languages (such as Python or Java) cannot compete with the performance of native libraries. The following versions were used for the benchmarks:

Testing environment

All 3 benchmarks provided in packet-capture-benchmarks were run on the following environment:

  • Linux Ubuntu 16.04 64-bit running as a VirtualBox VM with 4 virtual cores and 8GB RAM
  • GCC 5.4.0 compiler
  • The host platform is a MacBook Pro model 2017 with Intel Core i7 760 3.1GHz processor and 16GB RAM running MacOS High Sierra 10.13

Benchmark applications:

Test results

Benchmark #1 - TCP parsing

Library Time taken(seconds) Packets per second
libpcap 0.12 4166666
PcapPlusPlus 0.219 2283105
libtins 0.241 2074688
libcrafter 6.26 79872

Benchmark #2 - TCP + TCP Options parsing

Library Time taken(seconds) Packets per second
libpcap 0.12 4166666
PcapPlusPlus 0.218 2293577
libtins 0.288 1736111
libcrafter 10.569 47308

Benchmark #3 - DNS parsing

Library Time taken(seconds) Packets per second
libpcap 0.028 17857142
PcapPlusPlus 0.234 2136752
libtins 0.245 2040816
libcrafter 6.791 73626