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

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to