perf: cache SQL schema descriptors and add operation discovery fast-path#876
Open
Remo wants to merge 3 commits into
Open
perf: cache SQL schema descriptors and add operation discovery fast-path#876Remo wants to merge 3 commits into
Remo wants to merge 3 commits into
Conversation
Item 1 (SQLSchema): Replace the old two-step approach (cache raw DBAL Table, re-process columns every request) with a fully cached pipeline. The new buildPropertyDescriptors() stores a serializable array of type names, nullability, and default values. discoverProperties() hydrates these into OData DeclaredProperty objects without touching the database again on cache hits. Item 5 (Operation): Add an early-exit in Operation::discover() that checks for any LodataOperation attributes before doing the full per-method reflection scan. Models without operations (the common case) return immediately.
The descriptor cache in SQLSchema bypasses columnToDeclaredProperty(), but EloquentEntitySet overrides that method to apply hidden/visible filters and Eloquent cast type overrides (e.g. 'array' → collection). Without that hook, array-cast columns reach String_::set() and trip "Array to string conversion". Override discoverProperties() in EloquentEntitySet with the upstream per-column flow so the cast and visibility logic runs. Pure SQLEntitySet still uses the new descriptor cache. Revert the redis discovery test to expect the legacy Table-cache key for Eloquent.
phpstan no longer reports an error on the suppressed line, so the ignore directive trips the non-ignorable ignore.unmatchedLine rule and fails the Analysis CI job.
Contributor
|
@AHolzerSCT can you test this branch in your application to double-check? |
|
@Remo @27pchrisl I tested it today. Everything seems to be working just fine, but I do actually loose the biggest portion of the improvements:
|
Contributor
Author
|
@AHolzerSCT I guess this is not something you could easily publish as a test case so that we can have a closer look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 1 (SQLSchema): Replace the old two-step approach (cache raw DBAL Table, re-process columns every request) with a fully cached pipeline. The new buildPropertyDescriptors() stores a serializable array of type names, nullability, and default values. discoverProperties() hydrates these into OData DeclaredProperty objects without touching the database again on cache hits.
Item 5 (Operation): Add an early-exit in Operation::discover() that checks for any LodataOperation attributes before doing the full per-method reflection scan. Models without operations (the common case) return immediately.