3 ms·
Talking about lookup tables without using constexpr is like pissing away performance.
by inetknght 8y ago
Talking about lookup tables without using constexpr is like pissing away performance.
- petermcneeley 8y agostd::set is used in the lookup table construction. We will have to wait till c++ finalizes how memory is allocated in constexp before this type of code will execute at compile time.
- inetknght 8y agoWhy wait for standard containers to be constexpr? This was recently shared on HN: https://github.com/hogliux/semimap https://github.com/hogliux/semimap
- pianoben 8y agoIMO this kind of lookup table is best computed externally, e.g. by a python script, and included as a literal `constexpr std::array` or something. I was recently trying to do something very similar with constexpr lookups, and threw in the towel due to different compilers having different levels of constexpr support. With literal tables, you know exactly what's going to happen. Constexpr has tons of promise, but the compiler support just isn't there yet - we still have to think really hard about it and look at the generated code to verify.
- beached_whale 8y agoWhat version of c++? Sounds like you are mixing 11 and 14+
- pianoben 8y agoc++14. I hit limits in clang relating to the depth of computation it will perform at compile-time, and those limits differ from gcc's and msvc's, so I switched. What do you mean by "mixing 11 and 14"?
- beached_whale 8y agoIt sounded kind of like the differences in constexpr between 11 and 14 where 11 only allowed a single statement type thing. Some people have used trampoline techniques to get around the depth limits. CRTP just did this for compile time regex.