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.
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:
- The PcapPlusPlus benchmark application can be found in PcapPlusPlus examples
- The other benchmark applications can be found in Matias Fontanini's packet-capture-benchmarks project
Test results
Benchmark #1 - TCP parsing
PcapPlusPlus is ~10% faster than libtins and ~x28 faster than libcrafter
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
PcapPlusPlus is ~32% faster than libtins and ~x48 faster than libcrafter
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
PcapPlusPlus is ~5% faster than libtins and ~x29 faster than libcrafter
Library | Time taken (seconds) | Packets per second |
---|---|---|
libpcap | 0.028 | 17857142 |
PcapPlusPlus | 0.234 | 2136752 |
libtins | 0.245 | 2040816 |
libcrafter | 6.791 | 73626 |