Benchmarking a small piece of generic code such as this library is challenging
because no benchmark can represent every actual use-case. What looks good on
paper might perform poorly in practice, and vice-versa. Neither the comparison
similar solutions is trivial. It is obvious, that devector
excels if it can take advantage of its small buffer optimization. However,
comparing a small buffer enabled devector
to a standard vector is just measuring the performance of the memory allocator.
It was tried to compare equivalent functionality of different containers, but the measurement gave surprising results. [1]
Instead of disclosing those unreliable performance numbers, the actual compiled
code is presented here, to prove that the quality of the generated code matches
the equivalent standard implementations. Below, a loop is shown, pushing back
a constant value into a std::vector
/devector
. The code is compiled using GCC
5.2 with -O2
-march=native
on
a AMD FX 8320 processor.
Table 1.1. Assembly code of v.push_back(1) loop
std::vector |
devector |
---|---|
|
|