3 ms·
Yes, there is support for laziness (see "streams"). A couple things to keep in mind: floating point values in Ocaml are boxed (floats are actually pointers to f
by gmfawcett 11y ago
Yes, there is support for laziness (see "streams"). A couple things to keep in mind: floating point values in Ocaml are boxed (floats are actually pointers to float data on the heap), and integers are one bit shorter than native types (31 or 63 bits) due to the way that Ocaml values are tagged internally. The native compiler generates good, predictable, but fairly simple code: few optimizations are applied (although there is active work underway, in the "flambda" project, that will significantly change this). Also, there is of course a garbage collector, though it is quite efficient in most cases. These factors may or may not be a performance issue in your own project.
- DonPellegrino 11y agoIn practice the generated code is already extremely fast and the 1-bit shorter ints help make the GC one of the fastest I've seen. If you do a lot of floating point calculations, you can put your floats in an array and they'll become unboxed.