13 ms·
Yeah I guess I was mainly just asking "is const powerful enough yet for this to be a trivial addition". > Instead, you get bloated binaries and longer compile
by vlovich123 2y ago
Yeah I guess I was mainly just asking "is const powerful enough yet for this to be a trivial addition".
> Instead, you get bloated binaries and longer compile times
Longer compile times probably are solved by having the strings live in a standalone compilation unit which the compiler will end up caching and you can only dirty it by adding a new string. Needing to shuffle that extra data around might still cost extra compile time, but in a real world program I suspect that's likely to not matter (both in terms of binary size & that other things in the program will be more expensive to compile).
That being said I agree that doing a LazyLock is probably sufficient and given the amount of entries being compared against acquiring the lazy lock probably also gets amortized (it's cheap but not free).