Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge performance drop since 2.3.2 release #820

Open
jmsche opened this issue Feb 17, 2025 · 7 comments
Open

Huge performance drop since 2.3.2 release #820

jmsche opened this issue Feb 17, 2025 · 7 comments

Comments

@jmsche
Copy link
Contributor

jmsche commented Feb 17, 2025

Hello,

For the main project at work, I noticed a significant performance drop when upgrading from version 2.3.1 to either 2.3.2 or 2.3.4 (tested both).

At the beginning I suspected PHPUnit v12 upgrade (as I upgraded both at the same time), but after reverting everything & upgrading Foundry only, I figured out it is the culprit 😅

So about the performance drop:

  • with Foundry 2.3.1, tests last around 1min 15sec
  • with Foundry 2.3.2/2.3.4, tests last around 2min 15sec

Our test suite is half functional tests & half unit tests (2136 tests in total).

I'm going to try to investigate further, but rather tomorrow I think.

@nikophil
Copy link
Member

I just tried to check the differences on a big testsuite (+4000 tests, 2/3 are functional tests) and I could not see a real difference 🤔

nor on the Foundry's testsuite 🤷

I'd be curious to know where it is coming from... Sadly, even if it was a bugfix release, we released a ton of stuff in v2.3.2

that won't be so easy to find where it is coming from...
maybe this ?

What about the memory consumption?

@jmsche
Copy link
Contributor Author

jmsche commented Feb 18, 2025

Hi nikophil,

Memory consumption is ~213MB with Foundry 2.3.1, and ~251MB with Foundry 2.3.4.

Using 2.3.4, I reverted the modifications in the PR you mentioned but this didn't change anything, I'll investigate this today & tomorrow.

@jmsche
Copy link
Contributor Author

jmsche commented Feb 18, 2025

I did some vendor bisect (thanks Grégoire for their post), and if I did it correctly, here is the commit that impacts performance: 98f018c

Please tell me if I can help debug the issue (other than sharing the entire work project 😅)

@nikophil
Copy link
Member

nikophil commented Feb 18, 2025

Memory consumption is ~213MB with Foundry 2.3.1, and ~251MB with Foundry 2.3.4.

ok, even if the memory is a little bit impacted, this is definitely not the culprit...

Using 2.3.4, I reverted the modifications in the PR you mentioned but this didn't change anything,

thanks, to have tried, at least :)

I did some vendor bisect (thanks Grégoire for their post), and if I did it correctly, here is the commit that impacts performance: 98f018c

super cool, thanks, this already really restricts the scope!

Please tell me if I can help debug the issue

Not sure what to do... In this PR we're calling $em->persist() on every entity created with Foundry. This allows to not depend on whether the relation is defined with cascade: ['persist'] or not. I'm quite surprised that the problem is coming from there, because in a way or another, at the end, all entities created by Foundry get added to the UoW 🤔

@nikophil
Copy link
Member

nikophil commented Feb 18, 2025

hey, few more questions please:

  • do you use dama?
  • do you use Foundry's extension for PHPUnit?
  • which version of Symfony & doctrine do you use?
  • do you reset your database using ResetDatabase trait? which strategy?

few more things to try:

thanks 👋

I tried few things on Foundry's testsuite, but I cannot reproduce any overhead with the given PR

@jmsche
Copy link
Contributor Author

jmsche commented Feb 19, 2025

Hi Nicolas,

  • Yes, DAMA is used in the project
  • Not using Foundry PHPUnit extension
  • Symfony 7.2.3
  • Doctrine:
    • DBAL: 3.9.4
    • ORM: 3.3.2
  • Not using the ResetDatabase trait
  • Tried commenting out the lines you mentioned, but no performance changes :/

@nikophil
Copy link
Member

thanks tor these information.

Tried commenting out the lines you mentioned, but no performance changes

ok, I'm kinda relieved it's not coming from here 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants