Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Specialized dictionaries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-11-05 (20:55)
From: Marcin 'Qrczak' Kowalczyk <qrczak@k...>
Subject: Re: [Caml-list] Specialized dictionaries
Mon, 5 Nov 2001 19:24:06 +0100, Nicolas George <> pisze:

>>				    So updates are rare, dictionaries are
>> small and they contain small integers, but lookups are very frequent.
> What about using a simple array for that?

Then usually contain small integers, but theoretically these integers
can go large. If many types are created in a program, then it would
be wasteful to allocate large arrays for each dispatched function
which uses a single type with a large number.

Perhaps some heuristic could use an array for the initial segment
of numbers (which correspond to types created earlier) and another
dictionary for the rest, but it would complicate what is being
done purely for fun and for being simple. More importantly, small
differences such that loading modules in a different order could have
large effects; I don't like treating old types and young types in a
very different way.

I've heard about packing multiple dispatch tables in a large array.
Well, it's complicated, and it's hard to perform dynamic updates if
slots are used by different functions. Updates are rare but they do
occur - for example if a dispatched function is used at a type for
the first time and the implementation was found at its supertype.

I don't know...

 __("<  Marcin Kowalczyk *

Bug reports:  FAQ:
To unsubscribe, mail  Archives: