Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search


From: robbo1mark:aol at: 7-Jun-2001 7:26

Everybody, for those of you, Larry, Ladislav, Joel, Volker etc. who have been discussing the implementation of REBOL tuple! & other types, well here is an old posting from the OSCAR Project regarding our discoveries of REBOL datatypes. mark Dickson
>> old OSCAR mailing follows >>>
> If I understand you correctly you ar saying that all REBOL values > can be contained within 96 bits ie 3 x 32 bit-words. Maximum size
per value
> 12 BYTES. > > Is this correct ?
Yes... Every series! does not fit into 12 bytes. The values fitting into 12 bytes are all values that have no pointers. (with exeption of bitset! The length of bitset is 256 bits) Tuple is a value that has variable length. It extents to 10 bytes. To make a fast REBOL interpreter some rules aply: 1 all values have to be of the same length for fast indexing. 2 values should be as small as possible. (for speed) 3 values should use use most of the reserved room. values have to be at least 2 32 bits words ( = 8 bytes ) to supply enough room for a index and a pointer. (used by series). It also needs some room to store the datatype_id. This could be done in a byte but then you would end up with a value with a length of 9 bytes. This is not fast, so the structure has to expand to 12 bytes for speed. (most processors use 32 or 64 bits words). This extra 2 or 3 bytes are used by some datatypes to store even more data. This applies to rule 3. With tuple all room is used. Example: If the structure is 12 bytes a tuple can be of length 10:
If the structure is 10 bytes a tuple can be of length 8:
If the structure is 16 bytes a tuple can be of length 14:
Doing some math the most economic size is 12 bytes. Not to big and fast.
> Also I didn't quite follow your tuple explanation, could you
possibly please
> clarify this using Andrews example of a ten value tuple each with
the value
> 255 (ie 1 BYTE number), expalining how this would be structured
> the datatype_id & series_length values.
A 10 value tuple needs 10 bytes to store it's value. Because the model has to put this into 12 bytes. 2 bytes are left to store the tuple_length. tuple_length is a integer from 0 to 7. real tuple length = tuple_length + 3 Together with the datatype_id it has to fit into a 16 bit word. 3 bits are needed for the tuple_length. The other 13 bits can be used to store the datatype_id. Daan Oosterveld