Need help avoiding LargeInteger>>*

Chris Muller afunkyobject at yahoo.com
Fri Mar 7 19:17:37 UTC 2003


Thank you, everyone, for your thougtful and informative responses.

Mister Arning!  Score!  You have just made my weekend!  I did not realize
LargePositiveInteger>>digitAt: and digitAt:put: were congruent with the
representation in a ByteArray.  Now, I can avoid large-integer arithmetic
altogether!

Additionally, I changed my put method, maUint:at:put:, to use digitAt:put:
instead of those large-integer division/modulo operations.  The performance
improvement there is even more staggering.  From just under 3000 puts/sec to
137000 puts/sec!

I have a feeling this is going to be an astonishing performance improvement for
Magma overall.  I use 64-bit numbers for way more than just hash-index keys.  I
use them for oids as well (although, for small databases, the oids are still in
the SmallInteger range anyway, but this'll be great for large repositories).

I can't wait to check my new commit rate and how this affects Magma's overall
performance feel.

Thank you veddie much!

 - Chris
 
> Here are a couple of 64-bit snippets. The first seems 2 to 3 times faster and
> the second 5 to 6 times faster.
> ======================
> 	^
> 		((self unsignedLongAt:  anInteger + 5 bigEndian: false) bitShift: 32) + 
> 		(self unsignedLongAt:  anInteger + 1 bigEndian: false)
> ======================
> 	result _ LargePositiveInteger new: 8.
> 	1 to: 8 do: [ :i | result digitAt: i put: (self at: anInteger+i)].
> 	^result
> ======================
> 
> Cheers,
> Bob


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/



More information about the Squeak-dev mailing list