Benchmarking Smalltalk on JVM
Rémi Forax
forax at univ-mlv.fr
Wed Feb 1 14:10:09 PST 2012
On 02/01/2012 10:44 PM, Mark Roos wrote:
> 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
if you know it will never escape,you should use an int directly.
Rémi
More information about the mlvm-dev
mailing list