3 ms·
> It's kind of like the small string optimization you see in C++ ... Agreed. These types of optimizations can yield significant benefits and are often employed
by AdieuToLogic 7mo ago
> It's kind of like the small string optimization you see in C++ ...
Agreed. These types of optimizations can yield significant benefits and are often employed in language standard libraries. For example, the Scala standard library employs an analogous optimization in their Set[0] collection type.
0 - https://github.com/scala/scala3/blob/88438e2c6e6204e12666067926d43ebfe91d3dfa/library/src/scala/collection/immutable/Set.scala#L168 https://github.com/scala/scala3/blob/88438e2c6e6204e12666067...