[email protected] wrote: [...]
Is it, what you propose that the JVM replaces iadd instructions (et al) with the resp. bytecodes to extract the primitive integer value and apply the operation on that value? How would that improve performance? I can think of two possible explanations for bad performance with boxed primitives: 1. added redirection. 2. allocation costs. How would you make that go away?
Does the JVM even has to realize an int object before something specific to the object is done? I think not. I think that in many cases the JVM does not have to create an actual Integer and thus does not have to pay the cost of creating the actual object. About bad performance... The problem is that either I handle Integer, then for a Integer+Integer I have to unbox both and most probably also box again. Or I handle int, and then I have to live with the problems regarding for example assigning null.
I see the way out of there only through something along the lines of John Rose's proposals of introducing tagged values like tuples and fixnums as outlined here: http://blogs.sun.com/jrose/entry/tuples_in_the_vm http://blogs.sun.com/jrose/entry/fixnums_in_the_vm
but the VM will then still not provide an "iadd" for them, will it? You will still have to call some kind of method, that does the add for you. How fast that will be in the end, I don't know. But usually the VM does not inline methods very fast and the rules as of when this will happen for sure are also not there or even fixed between the versions. So I end up with a special solution that later will may be a performance penalty.
bye blackdrag -- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead http://blackdragsview.blogspot.com/ For Groovy programming sources visit http://groovy.codehaus.org -- You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
