Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Bug? Printf, %X and negative numbers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ville-Pertti Keinonen <will@e...>
Subject: Re: [Caml-list] Bug? Printf, %X and negative numbers

> I was thinking of just a bitmask.  You are always allocating into the
> minor heap.  You just define the low 1/32nd of the minor heap a 
> bitmask of
> what is a pointer and what isn't.  This would probably slow down
> allocation- not by much, would be my prediction, but it would slow down
> allocation.  You may gain some of that cost back by not needing to do 
> the
> shifts and ors we currently do to deal with the low bit.  I can't 
> predict
> what the overall performance delta would be- not even if it will be
> positive or negative.

I suspect that would be quite slow, since you have to do one bit 
operation for each word of each allocation (optimizing them is 
difficult because you don't know the alignment).

One way of doing this much faster is just having a the first word of 
any mixed block (homogenous blocks aren't a problem) indicate the 
number of pointers and always put the pointers first.

Of course wasting an entire word on this is nasty when less bits would 
do...but the bits of the current block header are pretty tightly 
allocated.

-------------------
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