You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README-161.html 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  2. <html> <head>
  3. <title>AspectJ 1.6.1 Readme</title>
  4. <style type="text/css">
  5. <!--
  6. P { margin-left: 20px; }
  7. PRE { margin-left: 20px; }
  8. LI { margin-left: 20px; }
  9. H4 { margin-left: 20px; }
  10. H3 { margin-left: 10px; }
  11. -->
  12. </style>
  13. </head>
  14. <body>
  15. <div align="right"><small>
  16. &copy; Copyright 2008 Contributors.
  17. All rights reserved.
  18. </small></div>
  19. <h1>AspectJ 1.6.1 Readme</h1>
  20. <p>The main themes of AspectJ1.6.1 are better memory usage and faster weaving.
  21. This has been achieved through profiling of the weaving process and has
  22. resulted in some serious refactoring of the weaver component within AspectJ. It provides
  23. exactly the same functionality as in previous releases, it just weaves faster now, using
  24. less code and less memory. This readme will give an overview of the kind of changes
  25. made and what can be expected when using 1.6.1 compared to previous releases.</p>
  26. <p>The complete list of issues resolved for AspectJ 1.6.1 can be found with
  27. these bugzilla queries. The first lists bugs addressed (more than 60!) whilst the second details
  28. enhancements made in this release.</p>
  29. <ul>
  30. <li><a href="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=AspectJ&target_milestone=1.6.1&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywords=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&bug_severity=blocker&bug_severity=critical&bug_severity=major&bug_severity=normal&bug_severity=minor&bug_severity=trivial&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=">Bugs resolved</a>
  31. <li><a href="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=AspectJ&target_milestone=1.6.1&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywords=&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&bug_severity=enhancement&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=">Enhancements implemented</a>
  32. </ul>
  33. <hr>
  34. <h2>Refactored (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=231396">bug 231396</a>)</h2>
  35. <p>The bugzilla entry goes into more specifics on what has changed, the end result is that aspectjweaver.jar has had around 275 classes removed (about 25%) and
  36. has slimmed down by 350k (about 20%). In terms of performance for different scenarios:
  37. <h4>Straight compilation</h4>
  38. <p>The refactoring effort has been focused on the weaver component, hence there is limited impact on the performance of source compilation but this comparison shows it is faster. Four scenarios are compared, in each scenario a different aspect
  39. is applied to the JDT compiler (just as a sample piece of source code).
  40. <ol>
  41. <li>1100 source files, few aspects that target 859 join points.
  42. <li>1100 source files, code style trace aspect targeting public methods (22000 join points)
  43. <li>1100 source files, annotation style trace aspect (22000 join points)
  44. <li>1100 source files, insane aspect (before(): within(*) {}) (203000 join points)
  45. </ol>
  46. <p>
  47. <center>
  48. <img src="perfSourceCompile_161.jpg"></img>
  49. </center>
  50. <h4>Binary weaving</h4>
  51. <p>Moving on from source compilation to pure binary weaving, the improvements are more obvious. Here we are using the complete JVM
  52. classes jar 'rt.jar' as an example of a large jar file for weaving.
  53. <ol>
  54. <li>Binary weaving rt.jar (~12000 classes) with a simple aspect (1200 join points)
  55. <li>Binary weaving rt.jar (~12000 classes) with a code style trace aspect (121000 join points)
  56. <li>Binary weaving rt.jar (~12000 classes) with an annotation style trace aspect (121000 join points)
  57. <li>Binary weaving rt.jar (~12000 classes) with an insane aspect (before(): within(*) {}) (352000 join points)
  58. </ol>
  59. <center>
  60. <img src="perfBinaryWeave_161.jpg"></img>
  61. </center>
  62. <h4>Loadtime weaving</h4>
  63. <p>The loadtime weaving improvements are similar to those seen for binary weaving (naturally). Here we are using the JDK
  64. tools jar 'tools.jar' as an example of a jar file for loadtime weaving.
  65. <ol>
  66. <li>Binary weaving tools.jar (~1900 classes) with a code style trace aspect
  67. <li>Binary weaving tools.jar (~1900 classes) with an insane aspect (before(): within(*) {})
  68. </ol>
  69. <center>
  70. <img src="perfLTW_161.jpg"></img>
  71. </center>
  72. <p>The refactoring work has also reduced the amount of unnecessary garbage created on the heap during the weaving process. The next comparison shows roughly the
  73. reduction in amount of 'stuff' created on the heap during a weave. This isn't the max heap required to do a weave, it is just showing how many less temporary objects
  74. are allocated during an entire run of the weaver
  75. <ol>
  76. <li>First, the number of kilobytes of memory allocated from the heap during a weave of tools.jar with a code style trace aspect
  77. <li>Second, another run of the same thing
  78. <li>Third, this time using the insane aspect
  79. </ol>
  80. <center>
  81. <img src="heapContents_161.jpg"></img>
  82. </center>
  83. <p>So in terms of memory required, weaving the insane aspect into tools.jar created 1.4G of 'stuff' over the entire weaving process, compared to 1.75G with 1.6.0.
  84. <h4>Loadtime weaving stress</h4>
  85. <p>As well as addressing the memory usage of a single load time weaver, we have also looked at the use of load time weaving in a larger
  86. scale scenario, where multiple classloaders are being instantiated and discarded over time and each has an associated load time weaver.
  87. Under <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=210470">bug 210470</a> we looked in detail at whether the lifecycle of the
  88. weaver instance correctly matched the lifecycle of the associated classloader. It did not, but now it does!
  89. Here is a memory usage graph for AspectJ1.6.1 - this shows an application that spawns 7 threads which run continuously for a few minutes. Each thread
  90. repeatedly creates a classloader, weaves 500 classes using it then discards the classloader. You can see that over time the memory is recovered
  91. correctly and when all threads complete (and all classloaders are orphaned), all the weavers are discarded.
  92. <p>First, AspectJ 1.6.0, in which memory was never correctly recovered and so an OutOfMemory problem would always occur eventually.
  93. <center>
  94. <img src="memLtwStress_160.jpg"></img>
  95. </center>
  96. <p>And now AspectJ 1.6.1:
  97. <center>
  98. <img src="memLtwStress_161.jpg"></img>
  99. </center>
  100. <h2>Incremental compilation</h2>
  101. <p>Following on from the work done to improve compilation under Eclipse in AspectJ 1.6.0 (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=221427">Bug 221427</a>
  102. ) - we now support the building of 'broken code' (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=102733">bug 102733</a>). This is something the JDT
  103. has always been doing - where code containing errors continues to build (if recovery is possible) but should the actual methods containing the errors get
  104. invoked, an exception will be thrown at runtime. A number of users typically extract large projects from their library
  105. systems, knowing that they will only partially build in their current eclipse setup, but as long at they do not invoke the code containing the errors then
  106. they expect the rest of the project to run normally. AspectJ now allows this mode of operation, and it has the additional effect that the state
  107. of the project stays consistent, albeit with known errors, and this means AspectJ will more frequently do incremental builds rather than falling back
  108. to full builds because there was a compilation error.
  109. <h2>Language changes</h2>
  110. <h4>Optmized syntax for annotation value binding (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=234943">Bug234943</a>)</h4>
  111. <p>If only binding an annotation at a method-execution join point in order to access an <b>enum value</b>
  112. within it, there is a more optimal syntax that can be used to produce faster code.
  113. Given this setup:</p>
  114. <code><pre>
  115. enum Colour { RED,GREEN,BLUE;}
  116. @interface ColouredAnnotation { Colour value(); }
  117. @ColouredAnnotation(Colour.RED)
  118. public void colouredMethod() { }
  119. </pre></code>
  120. <p>Current syntax:</p>
  121. <pre><code>
  122. before(ColouredAnnotation anno): execution(* *(..)) && @annotation(anno) {
  123. printTheColour(anno.value());
  124. }
  125. </pre></code>
  126. <p>New optional syntax:</p>
  127. <code><pre>
  128. before(Colour col): execution(* *(..)) && @annotation(ColouredAnnotation(col)) {
  129. printTheColour(col);
  130. }
  131. </pre></code>
  132. <hr>
  133. <!-- ============================== -->
  134. </body> </html>