[squeak-dev] Re: LargeInteger negative bitShift (Rshift) not optimized on byte boundary?

nicolas cellier ncellier at ifrance.com
Tue Jul 1 18:06:17 UTC 2008


nicolas cellier <ncellier <at> ifrance.com> writes:

> Notice that Rshift seems more efficient than Lshift on non byte boundary (nBits
> \\ 8 ~= 0)...
> 

x digitLength = 363,
 - so Rshift only has to shift 163 bytes,
 - versus 363 for Lshift...

What is surprising is that byteShift: is not much different.
 -  95 ms for 16,300,000 bytes to copy,
 - 103 ms for 36,300,000 bytes to copy,
That means time is not spent in copy. 
100000 allocation of a LargeInt that's probably measuring some scavenging...

I checked VW7.5 on same machine to get a reference:
| x |
x := SmallInteger maxVal raisedTo: 100.
OrderedCollection new
 add: (Time millisecondsToRun: [100000 timesRepeat: [x bitShift: -1600]]);
 add: (Time millisecondsToRun: [100000 timesRepeat: [x bitShift: -1597]]);
 add: (Time millisecondsToRun: [100000 timesRepeat: [x bitShift: 1597]]);
 add: (Time millisecondsToRun: [100000 timesRepeat: [x bitShift: 1600]]);
 asArray
VW: #(29 29 92 92)
squeak:  #(164 172 315 120)

I'm surprised by the factor 3 in VW...
But since more bytes are allocated in Lshift...
The byteBounded Lshift is not far from VW.
every other operation is definitly improvable.





More information about the Squeak-dev mailing list