[Vm-dev] bitXor: is slower than - on Spur32 (MacOSX) r3684

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sat Apr 23 21:22:36 UTC 2016


Hi,
for large integers (> 64 bits), a bitClear: implementation using bitXor: is
faster than by using - indeed we don't have to care of carry.

{
[(12398767868759866578644 bitOr: 567812564128976768553) -
567812564128976768553] bench.
[(12398767868759866578644 bitOr: 567812564128976768553) bitXor:
567812564128976768553] bench.
}
#('3,480,000 per second. 288 nanoseconds per run.'
 '4,950,000 per second. 202 nanoseconds per run.')

For large integers < 64 bits or small integers, I would expect sort of
similar speed, but bitXor: is slower:

{
[(1234 bitOr: 5678) - 5678] bench.
[(1234 bitOr: 5678) bitXor: 5678] bench.
}

#('170,000,000 per second. 5.88 nanoseconds per run.'
  '133,000,000 per second. 7.53 nanoseconds per run.')

{
[(12398767868754 bitOr: 5678125641253) - 5678125641253] bench.
[(12398767868754 bitOr: 5678125641253) bitXor: 5678125641253] bench.
}
#('7,100,000 per second. 141 nanoseconds per run.'
'5,110,000 per second. 196 nanoseconds per run.')

OK, (Smalltalk specialSelectors includes: #bitXor:) is false, but is it the
sole explanation?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160423/10134bd5/attachment.htm


More information about the Vm-dev mailing list