r/cpp • u/d_o_n_t_understand • Jun 01 '20
C++ Weekly - Ep - 3.5x Faster Standard Containers With PMR!
https://www.youtube.com/watch?v=q6A7cKFXjY0&feature=share
36
Upvotes
r/cpp • u/d_o_n_t_understand • Jun 01 '20
5
u/staletic Jun 01 '20
Two additional notes:
<memory_resource>yet.allocate()isn't polymorphic.allocate()callsdo_allocate()anddo_allocate()isprotectedand virtual. This should help your compiler to devirtualize the calls.4
u/RoyBellingan Jun 02 '20
Another crazy thing is using something like
https://github.com/johannesthoma/mmap_allocator
To basically save your memory layout, and reload from disk the memory image.
You can not have a faster loading time that just streaming from disk.
7
u/staletic Jun 01 '20
https://gist.github.com/bstaletic/fedb5aede9b9f54f51c50671ade75d39
Compared to what Jason Turner has shown, my snippets:
release()the entire memory of thememory_resource. This saves us from recursively running destructors, but also forces us to hold a raw pointer to the "blueprints", so~vector()doesn't get called at the end of scope.