Skip to content

perf(discovery): support caching discovery in one build pass#2085

Merged
brendt merged 1 commit into3.xfrom
feat/get-discoveries
Mar 31, 2026
Merged

perf(discovery): support caching discovery in one build pass#2085
brendt merged 1 commit into3.xfrom
feat/get-discoveries

Conversation

@innocenzi
Copy link
Copy Markdown
Member

This pull request adds support for caching Discovery with only one build pass.

It's not a big deal that this is not the case, because we don't care about discovery:generate performance, however since it does load the files it go through, some files can be loaded twice during the lifespan of the application, and that may cause issues (such as with files declaring functions without verifying if they exist before).

So this work by allowing (new BootDiscovery)() to return the list of discoveries, and allowing (new GenerateDiscoveryCache)() to receive a list of discoveries, in which case it skips building it again.

@github-actions
Copy link
Copy Markdown

Benchmark Results

Comparison of feat/get-discoveries against 3.x (f1162475c1a432bec8d9c8442f46f7c895db7765).

Open to see the benchmark results
Benchmark Set Mem. Peak Time Variability
ViewRenderBench(benchPlainHtml) - 21.956mb 0.00% 481.587μs -9.52% ±1.74% -35.31%

Generated by phpbench against commit de35a86

@brendt brendt merged commit 5e1731f into 3.x Mar 31, 2026
81 of 88 checks passed
@brendt brendt deleted the feat/get-discoveries branch March 31, 2026 11:05
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.

2 participants