Skip to content

chore: temporarily disable cascade relationship combinations #938

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

Merged

Conversation

nikophil
Copy link
Member

@nikophil nikophil commented Jun 11, 2025

in order to make the CI pass again since sebastianbergmann/phpunit#6213, let's temporarily disable this behavior, until we find a solution.

Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark?

@nikophil
Copy link
Member Author

@kbond

Benchmark?

you can see here the benchmark result:

+--------------------------------+-------------------+-----+------+-----+-----------------+------------------+-----------------+
| benchmark                      | subject           | set | revs | its | mem_peak        | mode             | rstdev          |
+--------------------------------+-------------------+-----+------+-----+-----------------+------------------+-----------------+
| CategoryFactoryBench           | bench_create      |     | 10   | 5   | 17.969mb +0.01% | 5.084ms +0.25%   | ±4.35% -11.61%  |
| CategoryFactoryBench           | bench_create_many | 1   | 10   | 5   | 17.976mb +0.00% | 5.992ms +18.43%  | ±4.42% +4.06%   |
| CategoryFactoryBench           | bench_create_many | 10  | 10   | 5   | 21.416mb +0.00% | 38.614ms +0.14%  | ±0.83% -17.15%  |
| CategoryFactoryBench           | bench_create_many | 50  | 10   | 5   | 36.218mb +0.00% | 179.635ms -0.23% | ±0.84% +5.95%   |
| ContactFactoryBench            | bench_create      |     | 10   | 5   | 17.752mb +0.00% | 2.117ms -5.23%   | ±5.88% +17.51%  |
| ContactFactoryBench            | bench_create_many | 1   | 10   | 5   | 17.756mb +0.00% | 2.467ms +8.96%   | ±3.42% -3.52%   |
| ContactFactoryBench            | bench_create_many | 10  | 10   | 5   | 18.638mb 0.00%  | 10.672ms -2.27%  | ±3.69% +96.23%  |
| ContactFactoryBench            | bench_create_many | 50  | 10   | 5   | 22.791mb 0.00%  | 46.658ms -0.70%  | ±2.30% +188.71% |
| PersistentDocumentFactoryBench | bench_create      |     | 10   | 5   | 16.265mb 0.00%  | 781.903μs +0.32% | ±2.66% +14.50%  |
| PersistentDocumentFactoryBench | bench_create_many | 1   | 10   | 5   | 16.269mb 0.00%  | 831.145μs -1.88% | ±4.11% +34.89%  |
| PersistentDocumentFactoryBench | bench_create_many | 10  | 10   | 5   | 16.405mb 0.00%  | 4.811ms +0.56%   | ±1.89% -6.21%   |
| PersistentDocumentFactoryBench | bench_create_many | 50  | 10   | 5   | 18.001mb 0.00%  | 23.281ms +1.05%  | ±1.48% +73.92%  |
+--------------------------------+-------------------+-----+------+-----+-----------------+------------------+-----------------+

almost all bench are equals to the previous version. The only one which is above the 10% threshold is:

+--------------------------------+-------------------+-----+------+-----+-----------------+------------------+-----------------+
| benchmark                      | subject           | set | revs | its | mem_peak        | mode             | rstdev          |
+--------------------------------+-------------------+-----+------+-----+-----------------+------------------+-----------------+
| CategoryFactoryBench           | bench_create_many | 1   | 10   | 5   | 17.976mb +0.00% | 5.992ms +18.43%  | ±4.42% +4.06%   |

this one mesures the time taken by CategoryFactory::createMany(1) when it is run 10 times (10 revs). It performs 5 iterations (its) and I think it takes the average of those iterations.

This average is 5.992ms and is +18% above than the bench on 2.x. Both ran on the exact same code, so the difference comes from some "versatility" of the code (maybe because of the db I/O I think). I could reduce this "versatility" (not sure this is the good term 😅 ). Maybe this benchmark needs some fine-tuning, but I couldn't do it without a significant increase in the duration of the benchmark.

As a comparison here is a benchmark result with a "real" performance problem (when enabling the global event system)

| benchmark                      | subject           | set | revs | its | mem_peak         | mode              | rstdev         |
+--------------------------------+-------------------+-----+------+-----+------------------+-------------------+----------------+
| CategoryFactoryBench           | bench_create      |     | 10   | 5   | 17.941mb +3.36%  | 6.961ms +42.50%   | ±3.15% -46.07% |
| CategoryFactoryBench           | bench_create_many | 1   | 10   | 5   | 17.953mb +3.35%  | 7.537ms +36.44%   | ±4.48% -16.12% |
| CategoryFactoryBench           | bench_create_many | 10  | 10   | 5   | 21.384mb +24.87% | 52.092ms +35.94%  | ±2.06% +80.35% |
| CategoryFactoryBench           | bench_create_many | 50  | 10   | 5   | 36.153mb +73.85% | 243.340ms +35.30% | ±1.75% +96.80% |
| ContactFactoryBench            | bench_create      |     | 10   | 5   | 17.723mb +0.85%  | 3.178ms -4.61%    | ±2.42% -15.81% |
| ContactFactoryBench            | bench_create_many | 1   | 10   | 5   | 17.727mb +0.91%  | 3.185ms +13.37%   | ±6.07% -12.84% |
| ContactFactoryBench            | bench_create_many | 10  | 10   | 5   | 18.606mb +7.91%  | 14.116ms +20.28%  | ±4.41% +96.76% |
| ContactFactoryBench            | bench_create_many | 50  | 10   | 5   | 22.726mb +31.28% | 60.565ms +23.66%  | ±0.58% -36.64% |
| PersistentDocumentFactoryBench | bench_create      |     | 10   | 5   | 16.236mb +0.47%  | 836.236μs +10.56% | ±0.97% -17.80% |
| PersistentDocumentFactoryBench | bench_create_many | 1   | 10   | 5   | 16.241mb +0.47%  | 895.347μs +15.70% | ±0.71% -8.13%  |
| PersistentDocumentFactoryBench | bench_create_many | 10  | 10   | 5   | 16.306mb +3.79%  | 5.586ms +13.52%   | ±1.29% -2.29%  |
| PersistentDocumentFactoryBench | bench_create_many | 50  | 10   | 5   | 17.939mb +13.91% | 26.747ms +15.04%  | ±0.72% -31.87% |
+--------------------------------+-------------------+-----+------+-----+------------------+-------------------+----------------+

you can see almost all benchs result exploded.

@nikophil nikophil merged commit 030f7aa into zenstruck:2.x Jun 13, 2025
71 of 72 checks passed
@nikophil nikophil deleted the fix/disable-cascade-relationship-combination branch June 13, 2025 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants