Re:Is C++ fast?
by mynegation on Friday January 18, 2019 @12:50PM
(#18941155)
Author posted C version of their code[1]. As a couple of examples of how you can go back to idiomatic C++ starting from here:
1. replace all pointers by passing references to templatized vectors. On a high level of optimization they will be compiled to the same pointer arithmetic as C, but will give you type-safety on the source level.
2. Replace structs with clasess with short inlined accessors. On a high level of optimization they will be compiled to the same memory offset access
3. _If_ there is any value in making domain-specific sort generic - make it such
[1] https://gist.github.com/zeux/bf847986e0474cf48f61bb5749da38e...