Community
Participate
Working Groups
Created attachment 273007 [details] Early out for WildTypePatterns in KindedPointcut.fastMatch I have a Spring application that uses load time weaving. I have with several pointcuts that look like this: @Around("execution(@com.example.demo.Permissions * com.example..*Controller.*(..))") They match all annotated methods that are in classes with a specific naming pattern. For some classes the evaluation for one pointcut can take almost a second. Even for classes that do not match the naming pattern. The time depends on the number of methods. Examples are com.fasterxml.jackson.databind.ObjectMapper (part of spring-boot-starter-web, 201 methods), org.apache.cxf.jaxrs.JAXRSServerFactoryBean (84 methods), com.mchange.v2.c3p0.ComboPooledDataSource (216 methods) or org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration (485 methods). I tested this with aspectjweaver 1.8.13. The performance can be improved by adding an early out to KindedPointcut.fastMatch(). That way classes that don't match the naming pattern can be skipped and the expression does not have to be evaluated for every method. In my case this improves the startup time by 40-50 seconds. A patch is attached.
I just ran the test suite with the change in, good news is that it completely passes but I am scared to add it without more analysis and tests focused specifically on the change, particularly in the rc phase of 1.9.0.
I did build 1.9.3 RC1 with this in, but after further testing I am finding it breaks Spring Framework tests so I'm having to remove it again for now, pending investigation.