• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AOP & performance

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for you inputs and interesting links Gavin.
Thanks,
Bhushan
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your inputs.
Bhushan
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic