Re: Re: generics in ASM

Rémi Forax <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Le 22/07/2010 02:15, Eugene Kuleshov a écrit :
> Rémi Forax wrote:
>>>  Anyways, the only packages that exposing non-generified collections 
>>> to the user API are asm.tree and asm.tree.analysis the rest is just 
>>> internally used collections.
>>>
>>>  Internally, in a few places, ASM breaks the rules of strongly-typed 
>>> collections and storing different objects within the same collection 
>>> and then using instanceof instead of virtual lookup. That stuff 
>>> could be rewritten to be strongly typed, but that will likely 
>>> increase an in-memory representation of the tree model. Anyways, 
>>> performance impact should be compared for any code changes.
>> We can also use Object as argument type (like in List<Object>) to 
>> avoid virtual lookup.
>  Or we can leave these collections not generified.
>
>  BTW, Remi, can you remind me how much slower virtual lookup is 
> comparing to the instanceof?

I hate this kind of question :)
A virtual dispatch is slower but the VM optimizes invokevirtual calls to 
try to avoid
virtual dispatch. So instanceof can be slower or faster depending on the 
code
and the input data.
The only advantage of instanceof is that you do inlining by hand.
Knowing that the inlining heuristic of c1 is sometime grumpy,
it can give you some performance boost (not much).
But this is not true with c2.

>
>  regards,
>  Eugene
>
>

Rémi
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.