DamienHarper / auditor

auditor, the missing audit log library
MIT License
164 stars 53 forks source link

Performance issues with metadatas #137

Closed dmitryuk closed 1 year ago

dmitryuk commented 1 year ago

Closes https://github.com/DamienHarper/auditor-bundle/issues/319 Metadata cache should be configured to start it working

codecov[bot] commented 1 year ago

Codecov Report

Merging #137 (d2da374) into 2.x (098fe50) will decrease coverage by 0.03%. The diff coverage is 94.44%.

@@            Coverage Diff             @@
##              2.x     #137      +/-   ##
==========================================
- Coverage   92.98%   92.95%   -0.04%     
==========================================
  Files          44       44              
  Lines        1526     1561      +35     
==========================================
+ Hits         1419     1451      +32     
- Misses        107      110       +3     
Impacted Files Coverage Δ
src/Provider/Doctrine/DoctrineProvider.php 94.21% <94.11%> (-1.14%) :arrow_down:
...trine/Auditing/Transaction/TransactionHydrator.php 83.01% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

DamienHarper commented 1 year ago

Thanks again @dmitryuk! This one was on my roadmap :) Do you have some sort of before/after benchmark to better understand the gain?

dmitryuk commented 1 year ago

Test example:

    public function testExampleAsd()
    {
        $container = self::getContainer();
        $provider = new DoctrineProvider(new Configuration([]));
        $em = $container->get('doctrine.orm.entity_manager');

        for ($i = 0; $i< 50; $i++) {
            $provider->loadAnnotations($em, []);
        }
    }

Without cache: Time: 00:26.980, Memory: 52.50 MB

With cache: Time: 00:01.702, Memory: 46.50 MB