Benchmarking Smalltalk on JVM

Mark Roos mroos at roos.com
Wed Feb 1 13:44:30 PST 2012


Hi Charles

Its pretty simple.  All of my integers are boxed and are by definition 
immutable.  However I noticed
that many uses of integer were for loop counters and indexes where the 
integer never escapes from
the method.  So I added two primitives, one to copy a integer into a new 
box  and the other to increment
the java primitive held inside the box.  In all other ways it inherits 
from my Integer class.  The value is in
reducing Integer creation for big loop/index ints.

Usage looks like
        position := 1 newMutable.   gets a mutable integer with an initial 
value of 1
        position increment:1.       increments the internal primitive
        position <= 100000          normal integer compare method

I'll probably add a mutable bit to the header to protect the unwary in 
case it escapes but for now its
a power tool.

regards
mark





From:   Charles Oliver Nutter <headius at headius.com>
To:     Da Vinci Machine Project <mlvm-dev at openjdk.java.net>
Date:   02/01/2012 12:43 PM
Subject:        Re: Benchmarking Smalltalk on JVM
Sent by:        mlvm-dev-bounces at openjdk.java.net



On Tue, Jan 31, 2012 at 6:52 PM, Mark Roos <mroos at roos.com> wrote:
> For the initial JDK7 I get 400ms,  moving to jdk8 b20 it drops to 117ms 
(
> very nice).
> I then converted some constructor lookups to statics to get to 66ms.
> Then the obvious move to make an integer cache for which I used the 
jTalk
> range of -2000 to 4000 gave 30ms
> And finally ( to handle the index integer) I created a MutableInteger 
which
> dropped me to 5ms.

Can you explain MutableInteger a bit more?

- Charlie
_______________________________________________
mlvm-dev mailing list
mlvm-dev at openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20120201/860ccb80/attachment.html 


More information about the mlvm-dev mailing list