Re:Immer: immutable and persistent data structures for C++
by joatmon-snoo on Monday November 28, 2016 @12:33AM
(#13053614)
Are the benchmarks supposed to look like this, with tooltips all the way at the right?
I'm on Win7 x64 Chrome.
Re:Immer: immutable and persistent data structures for C++
by arximboldi on Monday November 28, 2016 @03:22AM
(#13054131)
That's how they look for me too. I agree it makes it hard to see which bar is what, but it makes it easy to scan all the results numbers in order.
So, the slowdown depends on the operation.
At the moment, comparing `immer::vector` to `std::vector`, example, for reading, using internal iteration (e.f. `for_each`) you get 1.5X, using iterators something like 2.5X, using [] something like 6X iteratively, something like 1.1 in random order.
Updating a single `int` element is like 100X. (This factor decreases with the size of the updated element, though!) But then, for example, `push_back` is only 1.1X std::list, and it does not rely on amortization, making it better for latency. Considering that you get access time similar to std::vector and persistence, it is a good deal. Also, with `flex_vector`, you get logarithmic slicing and concatenation, making these operations faster than for std::vector (when using big-enough vectors). Also, I am working now on _batch updates_ via transients, so if you update 10 elements in a row, you don't pay 10 times 100X (basically, you only pay the 100X once, which is very much ok for most use-cases, think like a 1microsecond tax per mouse click ;)
There are lots of trade offs one can make (in general, one can make updating a bit faster by making access a bit slower). Also, it depends a lot on the memory management strategy, which can also be customized.