help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Bench with OrderedCollection


From: Gwenael Casaccio
Subject: [Help-smalltalk] Bench with OrderedCollection
Date: Fri, 17 Jun 2011 13:16:58 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10

Hi,

I've made a small benchmark with Coq-Stack (no jit) and GNU Smalltalk.

{OrderedCollection } collect: [ :class |
  | queue |
  queue := class new.
  class -> (
  (1 to: 5) collect: [ :run |
  ObjectMemory globalGarbageCollect.
  {
   (Time millisecondsToRun: [ 1 to: 1000000 do: [ :each |
        queue addFirst: each ] ]).
   (Time millisecondsToRun: [ 1 to: 1000000 do: [ :each |
        queue removeFirst ] ]) } ]) ].

I use a tweaked VM (no more LINE_NUMBER byte code and few other changes) but the results are interesting:

Cog-Stack:
{OrderedCollection->#(#(178 264) #(116 262) #(116 260) #(114 262) #(116 260))}

Gst:
(OrderedCollection->((371 797 ) (323 658 ) (315 661 ) (317 660 ) (316 658 ) ) )

Now if I look at OrderedCollection>>#removeFirst at Squeak or Gst:

We see that GST decrease the size instead of Squeak so if we remove
the line:

self size < self shrinkSize ifTrue: [self shrink].

Gst without decreasing:
(OrderedCollection->((383 195 ) (284 196 ) (173 196 ) (172 196 ) (173 196 ) )

And I guess #addFirst: can be tuned  too :)

Cheers,
Gwen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]