> On 30 May 2016, at 19:03, Henrik Johansen <henrik.s.johan...@veloxit.no> 
> wrote:
> 

Hi!


> It's starting to come back to me; IIRC, + will normalize results to 
> SmallIntegers, digitAdd: will not.

not with Pharo5:

((LargePositiveInteger new: 3) digitAdd: SmallInteger maxVal - 10) class
=> SmallInteger



> I thought it would be nice to use a single
> replaceFrom:to:with:startingAt:
> call to insert the entire counter; however, I didn't bench that particular 
> part.

yes, it is nice


> So while the rewrite overall gained a small amount of speed, it turns out 
> digitAdd: is quite slow (even though it's a primitive), so reverting to using 
> Smallinteger arithmetic for the counter, and inserting the counter a digit at 
> a time is most likely worth it:
> 
> "Pharo4, LargeInteger counter"
> [OID new] bench '1,194,004 per second'
> 
> "Pharo4, reverted to SmallInteger counter"
> [OID new] bench '1,681,203 per second'

cool! Change looks good but please remove the obsolete >>#digitAdd: comment.

thanks a lot!!

holger

Reply via email to