Speed up URL/tag generation via Configuration clone fast-path#426
Merged
const-cloudinary merged 1 commit intomasterfrom Apr 26, 2026
Merged
Speed up URL/tag generation via Configuration clone fast-path#426const-cloudinary merged 1 commit intomasterfrom
const-cloudinary merged 1 commit intomasterfrom
Conversation
Reduce per-asset/per-tag Configuration construction overhead and tighten a few hot paths exercised by URL building. - Add Configuration::__clone() that deep-clones every section so cloning the global singleton produces a fully independent working copy without the cost of a JSON import/export round-trip. - Use the clone fast-path in BaseAsset::fromParams, BaseTag::configuration (replaces a pre-existing TODO), and BaseTag::fromParamsDefaultConfig instead of new Configuration(...). - Memoize BaseConfigSection::exportableKeys() per (class, sensitivity) to eliminate repeated ReflectionClass::getConstants() calls on every config serialization. - Replace array_values(section)[0] with current(section) in the two jsonSerialize implementations. Add tests/Unit/Configuration/ConfigurationCloneTest.php to lock in clone isolation across all configuration sections and across the asset/tag fast-paths, so a future regression to a shallow copy fails loudly.
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.
Reduce per-asset/per-tag Configuration construction overhead and tighten a few hot paths exercised by URL building.
Add tests/Unit/Configuration/ConfigurationCloneTest.php to lock in clone isolation across all configuration sections and across the asset/tag fast-paths, so a future regression to a shallow copy fails loudly.
Brief Summary of Changes
What does this PR address?
Are tests included?
Reviewer, please note:
Checklist: