You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5845 Reporter: thomasblanc Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:08:27Z) Resolution: won't fix Priority: low Severity: feature Category: ~DO NOT USE (was: OCaml general)
Bug description
I don't know if it's possible but it seems that double arrays are optimized so maybe it could be possible to do so with boolean arrays.
I find to use bool array way more intuitive and flexible than ints, specially because I sometimes don't know the size of my array and don't want to risk an error. After all, 31 bits is small.
So, how difficult would it be to make a boolean array something like an array of ints and let the compiler handle the painful xor, lsr and friends ?
The text was updated successfully, but these errors were encountered:
I'm marking this ticket as "won't fix" since I'm pretty sure the request of adding a special "automatic" runtime representation for bool arrays will not be granted.
It would be much better to have a specialized "bit field" data structure (probably implemented on top of strings). Btw, one can argue that it's not so great to have a special representation for float arrays: it adds complexity to the runtime system, limits some optimizations (e.g. for shortcutting lazy values) and imposes a runtime overhead to all array operations (in polymorphic contexts, at least).
Indeed: I believe there is a (weak) consensus that hardcoding the representation of float arrays was a mistake because it cause various pains in the compiler, runtime system and even metatheory (it's one of the reason why top types are not admissible in OCaml) of the language. We could instead use a specialize, monomorphic datastructures such as Bigarray which provides solid efficiency without the hacks.
The solution here is the same: use a specialized data structure. This can be developed as a third-party library so doesn't need to be in the compiler.
(On a slightly different note, integer bit operations are sometimes a bit disappointing in OCaml because the tagging logic makes them less efficient as they could be. If in the course of developping such a bit-packing library you discover situations where small specialized compile-time optimizations would make an important difference on real-world benchmark, you can contact Pierre Chambart which is interested in working on this kind of optimizations and, maybe, getting them integrated in the compiler.)
Original bug ID: 5845
Reporter: thomasblanc
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:08:27Z)
Resolution: won't fix
Priority: low
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
I don't know if it's possible but it seems that double arrays are optimized so maybe it could be possible to do so with boolean arrays.
I find to use bool array way more intuitive and flexible than ints, specially because I sometimes don't know the size of my array and don't want to risk an error. After all, 31 bits is small.
So, how difficult would it be to make a boolean array something like an array of ints and let the compiler handle the painful xor, lsr and friends ?
The text was updated successfully, but these errors were encountered: