At 05:41 PM 8/9/00 +0200, Bart Lateur wrote: >On Wed, 09 Aug 2000 10:04:15 -0400, Dan Sugalski wrote: > > >>5- Compact array storage: RFC still coming > > > >I hope this RFC will be "Arrays should be sparse when possible, and > >compact" and just about nothing else. :) > >You mean, something like hashes? Nope. >Faster hashes, maybe, with a hash function optimized for numerical >integer keys. I was thinking we might keep a bitmap for used/unused cells (with unused doubling as undef) and a two-level array pointing to chunks of real elements/element pointers. So, for example, if you did a: $foo[$elem]; perl would first check bit $elem to see if that element is in use. If so, it'd do a ($elem / chunk_size) to get the index to the chunk pointer in the array structure, then access element ($elem % chunk_size) to get a pointer to the ultimate thing. (Or the thing itself, if it were an int, say) Other methods are possible, of course, and which would be a win depends on your element distribution. (A linked list would be a win for very sparse arrays--$foo[time]) Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
- Re: Ramblings on "base class" for SV etc. Dan Sugalski
- Re: Ramblings on "base class" for SV etc. Chaim Frenkel
- Re: Ramblings on "base class" for SV etc. Ken Fox
- Re: Ramblings on "base class" for SV etc. Dan Sugalski
- Re: Ramblings on "base class" for SV etc. Bryan C . Warnock
- Re: Ramblings on "base class" for SV etc. Nick Ing-Simmons
- Re: Ramblings on "base class" for SV etc. Bart Lateur
- Hooks for array notation (was Re: Ramblings on "bas... Jeremy Howard
- Re: Hooks for array notation (was Re: Ramblings on "... Dan Sugalski
- Re: Hooks for array notation (was Re: Ramblings on "... Bart Lateur
- Re: Hooks for array notation (was Re: Ramblings on "... Dan Sugalski
- Re: Hooks for array notation (was Re: Ramblings on "... Bart Lateur
- Re: Hooks for array notation (was Re: Ramblings on "... Bart Lateur
- Re: Hooks for array notation (was Re: Ramblings on "... Dan Sugalski
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Karl Glazebrook
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Dan Sugalski
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Jeremy Howard
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Dan Sugalski
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Jeremy Howard
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Dan Sugalski
- Re: PDL-P: Re: Hooks for array notation (was Re: Ramblin... Dan Sugalski