Cool VL Viewer forum http://sldev.free.fr/forum/ |
|
Try a boost::container::flat_map for faster lookup http://sldev.free.fr/forum/viewtopic.php?f=10&t=2076 |
Page 1 of 1 |
Author: | kathrine [ 2020-10-08 01:15:16 ] | |||||||||
Post subject: | Try a boost::container::flat_map for faster lookup | |||||||||
Trying to speed up the joint_map_t cache. Looks beneficial in the profiler.
|
Author: | Henri Beauchamp [ 2020-10-08 08:05:31 ] |
Post subject: | Re: Try a boost::container::flat_map for faster lookup |
Yep, flat maps (and sets) are an interesting topic to optimize the code execution time. I explored this possibility last summer, with a systematic approach, i.e. converting all boost::unordered_map and boost::unordered_set containers with various flat containers alternatives (I tried phmap::flat_hash_*, tsl::hopscotch_*, tsl::robin_*, robin_hood::unordered_flat_*). Sadly the result was a randomly crashing viewer and no real obvious speed-up (no significative change in frame rates). The delicate point is that most flat containers got limitations (iterators invalidation and changing pointers to values, mostly), and even when taking those into account, these implementations are not bug-free, obviously. I therefore abandoned the idea... Your targeted approach (i.e. using the profiler to spot the places where such optimizations would be most welcome/useful) is definitely the way to go. Also, I did not try boost::container::flat_map, which may be safer (if slower) than the more modern alternatives I tried. I'll try your patch with v1.28.1 and see if it is safe (no crash): if it is, will adopt it. Thank you ! You will also need the fast-containers package: |
Author: | Henri Beauchamp [ 2021-07-17 12:29:04 ] |
Post subject: | Re: Try a boost::container::flat_map for faster lookup |
I refined my first boost containers replacement attempt, and the result can be experimented with in the 1.28.2.33 release published today (with the FAST_CONTAINERS option in indra/cmake/00-BuildOptions.cmake). In particular, I found how to avoid the crashes I was seeing so far (basically, by keeping boost::unordered_map for the problematic maps, but a proper diagnosis would be required to determine why the crashes happen in the first place, even if the prime suspect is a bug in the container implementation). Still, a more thorough and intensive testing is required before I would adopt any such new container for release viewers. The phmap implementation (a header-only re-implementation of absl containers) seems the most promising one. Under Linux, I can see a detectable frame rates boost (around 2 to 5%) over classical boost containers... Feel free to test and report your findings in this thread... |
Author: | ZaneZimer [ 2021-07-18 21:53:49 ] | |||||||||
Post subject: | Re: Try a boost::container::flat_map for faster lookup | |||||||||
I decided to give phmaps a try this weekend, since I always build the viewer for my specific 'rig' and to enable the newer curl (I haven't had any rainbow texture issues). I will say, I see a little increase in my fps with phmaps too. A bit more than Henri reported at roughly 5-10%, but no rigorous measurements. I have not experienced any crashes so far and have been using this build for a couple of days. |
Author: | Henri Beauchamp [ 2021-07-31 08:53:36 ] |
Post subject: | Re: Try a boost::container::flat_map for faster lookup |
I finally only kept the "parallel hashmap" containers as an option for replacing boost ones, and enabled them in today's v1.28.2.34 release. Let's see how they will fare on a larger users base... |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |