On Fri, Jun 20, 2003 at 03:58:38PM -0500, Brian Hurt wrote:
>
> First off, an apology. I was grumpy this morning about things completely
> irrelevent to the list- and thus responded a lot more hotly than was
> called for. Sorry. And thank you for being rational enough not to flame
> in return.
>
> Unless I'm missing something (which is possible), there are three possible
> implementations of Dynarray that I can see working:
>
> 1) Have the internal array be a 'a option array, and not a 'a array as it
> is currently. This means we are going through at least one, maybe 2
> references for every element, need it or not. If I understand things
> correctly, in this case a dynarray of booleans takes up 3 words per entry,
> and retrieving on takes two or three dereferences.
I just did some mini-tests, and it seems that compiler uses one Some
true and Some false value for all entries, i.e. one boolean takes one
word in bool option array.
However for ints it takes 3 words per array entry (if int's are all
different, when setting all the array to Some 3, it took one word per
entry).
> 2) Use the null value kludge. I agree that this is far from optimal- but
> it allows me to avoid options were not needed, and still write in Ocaml.
Maybe use first value put into array as null value, and maybe provide
way of setting null value as additional interface? This would have one
drawback, that this first value might be complex object with references
that would otherwise got GC-ed.
> WRT to unboxed floats, I myself wouldn't be horrified. The only data
> structure in which floats are unboxed (to my knowledge) is arrays.
Records with only-floats fields also use unboxed floats.
However my idea about unboxed floats in ocaml, is that floats are
extensively used in benchmarks :-)
--
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
|