File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AOP & performance

 
Bhushan Jawle
Ranch Hand
Posts: 249
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 249
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you inputs and interesting links Gavin.
Thanks,
Bhushan
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bhushan Jawle
Ranch Hand
Posts: 249
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your inputs.
Bhushan
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic