Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Precompile a template class in release mode
    primarykey
    data
    text
    <p>In order to save and access a lot of elements in an hashmap I wanted to test Google's Sparse Hash Map: <a href="https://code.google.com/p/sparsehash/" rel="nofollow">https://code.google.com/p/sparsehash/</a></p> <p>I just compiled all tests and demos in VS2012 using the debug mode. Well the result was incredibly slow for example the time_hash_map.exe printed "map_grow 50053.ns" with an average of 10.000.000 iterations. Okay.. now I compiled it in release mode the difference was immense! map_grow 917.0ns ! First I thought it is because the optimizations is erasing some stuff in the test program, but now I have implemented the dense_hash_map in my own program and it was really slow, while it was very fast in the release mode.</p> <p>I am still working on my program, and debugging in release mode is sometimes a pain in the ass, so I tried to precompile the dense_hash_map with the required template arguments. I created a second library that contains an cpp file: <code>template google::dense_hash_map&lt;uint64_t, int&gt;;</code> I've compiled this library in Release mode and linked it to my main application, but the performance is still the same :(</p> <p>What can I do in order to compile just this class (<code>dense_hash_map&lt;key,val&gt;</code>) with optimization while the rest of the program is compiled without optimizations.</p> <p>I think this huge performance gain is also very questioning, I have seen some nice optimization effects but this? It is like 50x faster per iteration. </p> <p><strong>EDIT:</strong> It seems like even disabling runtime checks and enabling optimizations doesnt result in the same speed as the release mode (still up to 10x slower), the only difference between my new debug mode and the original release mode is /MT for release and /MTd for my debug mode. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload