I have added some performance benchmarks with various conditions.
Numbers test
The basic test consists of a Numbers class with the property int $number = 0 and the methods get(): int and add(int $number).
The Numbers test will include 4 cases:
- Without Aspects:
- We don't have aspects here, so we emulate them
- Create
x NumbersService classes which act like the aspects
- Run the main method of the copies of the
NumbersService classes which modifies the Numbers class y times
- With Aspects:
- Clean the cache
- Create
x aspects
- Run the main method of the
Numbers class with the applied aspects y times
- With Cached Aspects:
- The same as "With Aspects", but without the boot up time (Generating proxy and woven files) that will be used from the cache
- Production environment:
- The same as "With Cached Aspects", but the cache will not be checked before loading the cached proxy and woven files
Time complexity
I created a GitHub workflow performance-tests.yml and also run them locally on my machines. Below in the comments are the results. Comment your results, if you have a workstation or a server for a better comparison.
Inspection
I have tested with Xdebug (Okapi/AOP 1.2.4) where the bottlenecks are and here is what I found:
I have added some performance benchmarks with various conditions.
Numbers test
The basic test consists of a
Numbersclass with the propertyint $number = 0and the methodsget(): intandadd(int $number).The
Numberstest will include 4 cases:xNumbersServiceclasses which act like the aspectsNumbersServiceclasses which modifies theNumbersclassytimesxaspectsNumbersclass with the applied aspectsytimesTime complexity
I created a GitHub workflow
performance-tests.ymland also run them locally on my machines. Below in the comments are the results. Comment your results, if you have a workstation or a server for a better comparison.Inspection
I have tested with Xdebug (
Okapi/AOP 1.2.4) where the bottlenecks are and here is what I found:WovenClassBuilder::buildMethod() / (new Factory)->fromMethodReflection($refMethod)takes some timeMeasurePerformanceTest::measurePerformance / $result = $numbers->get()in the$useAspectsif statement, takes some time (both in the uncached and cached test), this could possible be made better with this issue: Remove JoinPointInjector if possible #53