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

perf: various optimizations for Laravel/Symfony #6954

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

soyuka
Copy link
Member

@soyuka soyuka commented Feb 7, 2025

Few changes:

  • ModelMetadata was not a singleton in Laravel and we had 2 different instances
  • ModelMetadata clean up (some methods were dead code) + added memory cache for better speed in dev mode
  • defining uriVariables (for example: uriVariables: ['id']) is always faster then letting us compute them as we go through every property, added a local memory cache for that too
  • ReflectionClassRecursiveIterator is now used in 3 classes (compared to only one in API Platform 3.4), 2 of them are used with Symfony and 3 with Laravel, I added a simple local memory cache for that too as it loops over all declared classes in the project.

#6943 is a great start to remove that ReflectionClassRecursiveIterator but we need time to do it properly, and it also probably means proposing patches to Symfony + Doctrine-Bridge.

Blackfire: https://blackfire.io/profiles/compare/a1369434-ce45-4f88-88df-97049aa83f03/graph

20250207_16h07m25s_grim

@soyuka soyuka force-pushed the optimize branch 2 times, most recently from 696625e to e0d7c1e Compare February 7, 2025 15:20
@soyuka soyuka merged commit 49da8ec into api-platform:4.0 Feb 7, 2025
59 checks passed
@soyuka soyuka deleted the optimize branch February 7, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant