Skip to content

Performance Benchmarks #52

@WalterWoshid

Description

@WalterWoshid

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

  • TODO: For later I want to add some kind of formula for time complexity, so it can be measured with possible performance updates to the library.

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:

  • WovenClassBuilder::buildMethod() / (new Factory)->fromMethodReflection($refMethod) takes some time
  • In the MeasurePerformanceTest::measurePerformance / $result = $numbers->get() in the $useAspects if 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions