John Rose wrote: > The V8 technique sounds like a successor to Self's internal classing > mechanism; it sounds more retroactive. A key advantage of such > things is removal of indirections and search. If you want the "foo" > slot of an object in a prototype based language, it's better if the > actual data structures have fewer degrees of freedom and less > indirections; ideally you use some sort of method caching to link > quickly to a "foo" method which performs a single indirection to a > fixed offset. If the data structure has many degrees of freedom > (because there is no normalization of reps.) then you have to treat > the object as a dictionary and search for the foo more often. You > might be able to lookup and cache a getter method for obj.foo, but it > would be even better to have a fixed class for obj, which you test > once, and use optimized getters and setters (of one or two > instructions) for all known slots in the fixed class.
I'm fresh from reading Rhino source last night. Rhino currently does probably "level zero" optimization for slot access by caching the most recently-access hash bucket. As you'd expect, it's only a minimal gain, and only really useful if you're only using one bucket in sequence. In practice I'd be surprised if this is very common. I tried upping the code to have three MRU slots and got only a modest increase on nsieve. Turning it off resulted in only a minor decrease. So obviously there's more to be done there. I'm excited about the new VMs for the same reason you are...because I'm learning from the way they've solved dynlang problems and I'm trying to see how to apply these techniques on the JVM. What saddens me a bit, however, is that pre Java 7 JVMs suffer from a bytecode "totalitarian regime" whereby it's hard to get bytecode into the system and harder (or impossible) to get it out when you're done with it. I've got a bushel of optz I'd love to do in JRuby but simply cant because of the cost of all that bytecode churn. So to happy myself up, I'm working on JRuby + invokedynamic today. This stuff *has* to get into a shipping JVM. - Charlie --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---