Bug 565450 - Capturing a PR for optimized classloading
Summary: Capturing a PR for optimized classloading
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-22 16:30 EDT by Andrew Clement CLA
Modified: 2020-07-22 16:32 EDT (History)
0 users

See Also:


Attachments
patch (29.51 KB, text/plain)
2020-07-22 16:31 EDT, Andrew Clement CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2020-07-22 16:30:56 EDT
Raised as a PR on the AspectJ in github that I can't process but I don't want to lose the valuable work. As written there:

---
In our project we found out that during the build up of the spring context
the class loading takes a very long time.
Root cause is the huge amount of file I/O during pointcut class loading.
We are taking about ~250k file loads.

With these changes we managed to cut down the starting time by around 50%.

What we found out is that IMHO - the clear method of the ClassLoaderRepository
is called far too often -> in our settings this resulted in not a single cache
hit as the cache got cleared permanently.
Therefore we de-actived the cache clear calls inside the ClassLoaderRepository.

Secondly we changed the Java15AnnotationFinder in a way to not always create
new objects for the ClassLoaderRepository but re-use one static instance.
Otherwise we experienced >100k objects being created.

Last but not least we introduced a cache for unavailable classes so that
they do not have to be looked up using file I/O over and over again.

The whole behavior is configurable via

org.aspectj.apache.bcel.useSingleRepositoryInstance (default: true)
org.aspectj.apache.bcel.useUnavailableClassesCache (default: true)
org.aspectj.apache.bcel.ignoreCacheClearRequests (default: true)
---
Comment 1 Andrew Clement CLA 2020-07-22 16:31:25 EDT
Created attachment 283679 [details]
patch
Comment 2 Andrew Clement CLA 2020-07-22 16:32:00 EDT
fork is here: https://github.com/StrongSteve/org.aspectj