Home

PLF C++ Library - plf::stack - MSVC 2015 Benchmark results

Last updated 21-11-2016 v1.05

The test setup is a Haswell-class Xeon (E3-1241) on an Intel motherboard, 16GB ECC ram, running MSVC 2015 update 3 x64 as compiler, but almost identical results are available for a Core2Duo. Build settings are x64 release, "/O2 /Oi /Ot /Oy /GL". Tests are based on a sliding scale of number of runs vs number of elements, so a test with only 10 elements in a container may average 100000 runs, whereas a test with 100000 elements may only average 10 runs. This tends to give adequate results without overly lengthening test times. I have not included results involving 'reserve()' functions as the differences to overall insertion performance were not adequate.

Tests are carried out on the following types: (a) a 8-bit type ie. char, (b) a 32-bit type ie. int, (c) a 64-bit type ie. double, (d) a small struct containing two pointers and four scalar types, and (e) a large struct containing 2 pointers, 4 scalar types, a large array of ints and a small array of chars. In order to better facilitate accurate time-keeping for short tests, both container construction and destruction times are included in the tests. The sequence is as follows: construction, push N elements, read (back) + pop all elements, destruction. Because unlike a regular container, a stack must be pushed for every pop, and popped for every read, it makes little sense to analyse these aspects of use separately, as what is most important is the overall time taken. For that reason both separate and combined ("total time") benchmarks are presented below.

Construction + Push

Click images or hover over to see results at linear scale instead

test result graph
test result graph
test result graph
test result graph
test result graph

Back + Pop + Destruction

Click images or hover over to see results at linear scale instead

test result graph
test result graph
test result graph
test result graph
test result graph

Total Time

Click images or hover over to see results at linear scale instead

test result graph
test result graph
test result graph
test result graph
test result graph

Conclusion

Simply put, plf::stack out-performs both std::stack (std::deque) and std::vector under MSVC 2015 once both push and pop time are taken into account, except for char with more than 1000 elements, where vector has a performance advantage. We can also see that the larger the stored type is, the greater the performance advantage is.

Contact:
plf:: library and this site Copyright (c) 2017, Matthew Bentley