aspose file tools*
The moose likes Performance and the fly likes AOP & performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "AOP & performance" Watch "AOP & performance" New topic
Author

AOP & performance

Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
Recently I have been reading about AOP and some people suggesting it to be an approach for studying performance of an application. Dosen't weaving of aspects itself affect the performance ?
Thanks,
Bhushan
Gavin Bong
Ranch Hand

Joined: Apr 25, 2003
Posts: 56
Bushan,
This is a good topic as I would think Caching can be treated as an Aspect.

Recently I have been reading about AOP and some people suggesting it to be an approach for studying performance of an application.

When you say "studying performance"; I presume you mean the profilling of an application. Just like logging; profilling is a great application for AOP.
BTW JSR138 is about Performance Metric Instrumentation.

Dosen't weaving of aspects itself affect the performance ?

One class of AOP frameworks uses byte-code manipulation to inject code to intercept your method calls or class loading. I don't have numbers but since the aspects are being weaved in at the bytecode instruction set level; I would assume it is minimal (but only if the bytecode is efficiently coded, of course).
Finally, have you followed Cedric Beust's AOP Caching challenge. Here's the link
Cheers,
Gavin
Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
Thanks for you inputs and interesting links Gavin.
Thanks,
Bhushan
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Are you asking about the performance penalty of the weaving process or the loss of performance in the resulting code after weaving?
If you are referring to the process itself it depends on when it happens. Weaving may occur at compile-time, load-time, run-time, etc. Currently, AOP languages (AspectJ, HyperJ, ...) weave "aspects" into the primary code at compile-time. There are embryonic attempts at providing support for runtime weaving, but some research is still needed. Since we are more interested in the runtime performance, we don't care much of the performance penalty of the compile-time weaving process.
Concerning the performance "loss" of the weaved code, it all depends on how smartly the aspectual code is inserted into the primary code. This is clearly a matter of compiler implementation. Nobody can say that adding some code into primary code will affect your performance concern in a good/bad way. Of course, one may argue that as soon as you weave some aspectual code, your primary code will execute slowlier. My opinion is that lots of research has been done, but there is still a lot to be done as far as weaving optimization is concerned.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
Thanks for your inputs.
Bhushan
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Gavin Bong:
One class of AOP frameworks uses byte-code manipulation to inject code to intercept your method calls or class loading. I don't have numbers but since the aspects are being weaved in at the bytecode instruction set level; I would assume it is minimal (but only if the bytecode is efficiently coded, of course).

Mhh, that is a bold assumption, in my opinion. I don't think that programming in Java Bytecode can be much more efficient than programing in Java. I even remember Gosling saying something along the lines of Java Bytecode not being much more than a "serialized abstract syntax tree"...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AOP & performance