On 9/4/08, Martin Probst <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>
>  > My understanding of this optimization in V8 is that it's laser-
>  > targeted
>  > at probably the biggest bottleneck of Javascript: property lookup.
>
>
> Excuse my curiosity, but my basic understanding of this optimization
>  is like this: in JS, you don't have classes, so every object is
>  potentially completely different from all others. Therefore, you'd
>  always need to make the hash lookup when something says "foo.bar", as
>  everything foo might be is always different. Thus creating these
>  "hidden classes" allows you to classify sets of similar "foo" things,
>  so that you can cache the meaning of "bar" (i.e. offset from object
>  pointer) for these classes, I think this is called polymorphic inline
>  caching?
>
>
>  > but for languages like Ruby and Python, it would be an enormously
>  > useful technique.
>
>
>
> Now when you have a class based language like Python or Ruby, you
>  already have these sets of similar things where the same property
>  names resolve to the same things (the classes). I.e. if your "foo.bar"
>  statements gets hit with foo being a specific instance, you can see if
>  you cache contains the resolved location of bar for this class. Ruby
>  has this "eigenclass" exception, but that's probably a rare case.
>
>  So, I wonder how this optimization will help Ruby/Python/any class
>  based, dynamic language? Am I missing something?

Ruby is class based, but not only.
You can extend single living object in runtime and it turns this
object to singleton, creating new hidden subclass in fact.
So if you have some kind of framework dynamically creating such
singletons in runtime, it could possibly create a lot of hidden
subclasses.
IMHO. I'm not MRI or JRuby surgeon, this is only from application
developer point of view. :)

>
>  Regards,
>
> Martin
>
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to