45

The surprisingly high cost of static-lifetime constructors

6 years ago
ian $GMkWGfxZut

https://quuxplusone.github.io/blog/2018/06/26/cost-of-static-lifetime-constructors/

I was looking at HyperRogue again this week (see my previous post). It has a really nice localization framework: every message in the game can be translated just by adding a lookup entry to a single file (like, for the Czech translation, you add entries to language-cz.cpp); and then during the build process, all the language-??.cpp files are collated together and used to produce a single language-data.cpp file with a lookup table from each English message to the same message in every other language. (Seeing all the messages at once allows us to report on how “complete” each translation is, relative to the others.)