caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] implementing bit vectors in OCaml
@ 2003-06-01 17:03 Norman Ramsey
  2003-06-01 17:50 ` Ville-Pertti Keinonen
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Norman Ramsey @ 2003-06-01 17:03 UTC (permalink / raw)
  To: caml-list

We have a program that is spending a lot of time in set operations,
and we're thinking of trying an imperative implementation based on bit vectors.
I would hope that the basis of such an implementation would be an array
of native integers, but on scrutinizing the manual (espeically the chapter
on interfacing to C), I have concluded that such a thing is not possible.
Our choices appear to be

  * An array of native integers, which will be implemented as an array
    of pointers to native integers, because integers are boxed.

  * An array of tagged integers, which will be less efficient as
    dividing by 31 is more expensive than shifting.

How would the gurus recommend that we proceed?  Is there a better,
still efficient data structure for a set of small integers?

Could the compiler gods be persuaded to provide unboxed
representations for arrays of untagged integers, as is already done
for `float array'?


Norman

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: [Caml-list] implementing bit vectors in OCaml
@ 2003-06-02 13:29 Gregory Morrisett
  0 siblings, 0 replies; 9+ messages in thread
From: Gregory Morrisett @ 2003-06-02 13:29 UTC (permalink / raw)
  To: Norman Ramsey, caml-list

>   * An array of tagged integers, which will be less efficient as
>     dividing by 31 is more expensive than shifting.

Wait -- you can still use tagged integers.  Why do you need
to divide by 31?  You can still use Bits.lsr/lsl/land/etc, no?

-Greg

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-06-02 13:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-01 17:03 [Caml-list] implementing bit vectors in OCaml Norman Ramsey
2003-06-01 17:50 ` Ville-Pertti Keinonen
2003-06-02  8:21 ` Diego Olivier Fernandez Pons
2003-06-02  8:54 ` Hendrik Tews
2003-06-02  8:59 ` Claude Marche
2003-06-02  9:26 ` Xavier Leroy
2003-06-02 10:11   ` Marcin 'Qrczak' Kowalczyk
2003-06-02 10:10 ` Fabrice Le Fessant
2003-06-02 13:29 Gregory Morrisett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).