[ENH] shortcutnewinitialize-md

denker at iam.unibe.ch denker at iam.unibe.ch
Mon Jul 19 12:51:18 UTC 2004


from preamble:

"Change Set:		shortcutnewinitialize-md
Date:			19 July 2004
Author:			Marcus Denker

We changed new: to call initialize some time ago. Back
then Doug posted benchmarks that showed that we lost
a little bit of performance. The question was if we couldn't
speed the system back up with just a couple of shortcut
implementations of new: in some often used classes.

So, here are macrobenchmarks:

current, new: calling initialize, no prim.	
	 #(7551 36755 0 6326 0 8823 8823)
	 #(7484 36446 0 6451 0 8616 8616)
	 #(7494 36717 0 6633 0 8981 8981)

orig impl:	
	 #(7169 36148 0 6199 0 8800 8800)
	 #(7277 36549 0 6233 0 8659 8659)
	 #(7551 36144 0 6235 0 8880 8880)

So we are a tiny bit slower.

For Array new: I looked closer at the cost:
(bench runs the block 5 seconds and shows invocations/sec)

[1000 timesRepeat: [Array new:10]] bench

Array:
without:         '1070.985802839432 per second.'
with shortcut: ' '1725.0549890022 per second.''

So I did shortcuts for Array and String, and redid the
macrobenchmarks:

String/Array
	  #(7216 35802 0 6140 0 8897 8897)
	 #(7186 36142 0 6353 0 8590 8590)
	 #(7245 36227 0 6216 0 8722 8722)

So we are back at normal speed again. I don't think
we should do to much of these shortcuts, just in cases
were we see a problem. (e.g. classes that are instanciated often).
 
These are real hacks anyway: As these are just inlinings (and 
copy-down-the-inheritens-chain) of self-sends, an optimizing VM 
could do this automatically... 

This changeset adds the two new: methods to Array and String.
"!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shortcutnewinitialize-md.cs.gz
Type: application/octet-stream
Size: 1172 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040719/bb9865f9/shortcutnewinitialize-md.cs.obj


More information about the Squeak-dev mailing list