|Anonymous | Login | Signup for a new account||2014-03-10 04:51 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005845||OCaml||OCaml general||public||2012-12-05 10:26||2012-12-05 11:40|
|Priority||low||Severity||feature||Reproducibility||have not tried|
|Target Version||Fixed in Version|
|Summary||0005845: Optimizing boolean arrays|
|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 ?
|Tags||No tags attached.|
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.)
|2012-12-05 10:26||thomasblanc||New Issue|
|2012-12-05 10:43||frisch||Note Added: 0008565|
|2012-12-05 10:43||frisch||Status||new => resolved|
|2012-12-05 10:43||frisch||Resolution||open => won't fix|
|2012-12-05 10:43||frisch||Assigned To||=> frisch|
|2012-12-05 11:40||gasche||Note Added: 0008567|
|Copyright © 2000 - 2011 MantisBT Group|