4 ms·
This top bit is used by the garbage collector for performance. OCaml's GC is light enough that it simply does not feel like it exists at all. Integers also do n
by DonPellegrino 3y ago
This top bit is used by the garbage collector for performance. OCaml's GC is light enough that it simply does not feel like it exists at all. Integers also do not cause allocations.
Jane Street's blog explains the reasoning in detail[0]
[0] https://blog.janestreet.com/what-is-gained-and-lost-with-63-bit-integers/ https://blog.janestreet.com/what-is-gained-and-lost-with-63-...
- ufo 3y agoIIRC, some Smalltalks also use a similar trick.
- mkristiansen 3y agoI think this line explains what I was facinated by, "x * y is translated to CPU instructions (x >> 1) * (y - 1) + 1" namely that it now at least 3 extra highlevel operations to do simple multiplication.
- keithalewis 3y agoHow does paying employees to spend time on this make sense for a hedge fund?
- reikonomusha 3y agoOptimization of code is valuable in a lot of industries where time-to-complete or time-to-react is proportional to money spent/lost.
- keithalewis 3y agoMost of their cohorts just use C++ for that. Several Wall Street firms wrote their own language back in the day. Until the business people figured out IT people just liked to write languages and tell happy stories. They are in the money making business, not the language writing business. Division of labor. I spent 3 years at Morgan Stanley writing A+ and loved it. A+ is dead but kdb lives on, and is widely used at top hedge funds.
- WastingMyTime89 3y agoThat wasn’t done by Jane Street. This is part of the language from the start and was introduced by Leroy team at INRIA. As to the point of studying boxing, well, it’s fairly basic compiler theory. It will be hard to avoid if you have even the slightest interest in PL.