▲ | daanx 13 hours ago | |
> This idea is so simple, so crazy, so stupid, and works so well, but I never thought of it. Bravo to the authors. Thanks for the nice summary -- looking forward to read the paper! The same idea of self-tagging is actually also used in Koka language [1] runtime system where by default the Koka compiler only heap allocates float64's when their absolute value is outside the range [2e-511,2e512) and not 0, infinity, or NaN (see [2]). This saves indeed many (many!) heap allocations for float intensive programs. Since Koka only uses 1 bit to distinguish pointers from values, another slightly faster option is to only box negative float64's but of course, negative numbers are still quite common so it saves less allocations in general. [1] https://koka-lang.github.io/koka/doc/book.html#sec-value-typ... [2] https://github.com/koka-lang/koka/blob/dev/kklib/src/box.c#L... ps. If you enjoy reading about tagging, I recently wrote a note on efficiently supporting seamless large integer arithmetic (as used in Koka as well) and discuss how certain hardware instructions could really help to speed this up [3]: [3] https://www.microsoft.com/en-us/research/uploads/prod/2022/0... (ML workshop 2022) |