On Mar 25, 2011, at 5:26 PM, Mariano Martinez Peck wrote:

Hi. I have to say that I hate that the compiler associates a special bytecode for #class and that the VM don't even send the message. I want to be able to overwrite #class in a proxy for example, or to debug it.

I did some benchmarks disabling such optimization by doing:

    (ParseNode classVarNamed:  'StdSelectors') removeKey: #class ifAbsent: [].
    Compiler recompileAll.
   
And the difference is NOTHING in my tests (maybe I am doing something wrong).

With Standard VM and #class  optimization

[SystemNavigation default allObjectsDo: [:each | each class]] timeToRun   ->  aprox 50 miliseconds

What is the constant over head of doing just the iteration?

[SystemNavigation default allObjectsDo: [:each |  ]] timeToRun


What do you think?

I am for... for the JIT is is a monomorphic send to a primitive, so the IC will be very effective
and should take care that the lookup is actually almost never done. (and the lookup is the
only thing the #class bytecode saves, as the target method is a primitive).

Marcus

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.