Repository navigation
perf: resolve frontend asset files from the runtime cache - #173
Merged
Merged
Conversation
parse_output() looked up every asset of every block on the page on disk for each uncached page view: a glob() of the output directory, is_file(), filesize() and filemtime() per asset, and a recursive directory scan for CSS modules per block. The runtime cache already describes these files, and its watch snapshot covers both the source and the compiled file. The build now records what render_tag(), render_inline() and the inline stylesheet limit read from disk (resolved file, data-processed, size and the two version keys) on each asset, plus the CSS module files of each block, after compiling and pruning the output directory. Cached requests read these records. Asset data without a record (cache disabled, live refresh, last-good payloads while a peer rebuilds, third-party callers) keeps the disk lookup. CSS module files join the watch snapshot and the required paths, so a removed file invalidates the cache like a removed compiled asset. URLs and the disable filter are still resolved per request.
This was referenced Oct 23, 2026
Contributor
|
Merged and released in Blockstudio 7.7.8, with the reviewed implementation and regression coverage. The release commit passed all 20 CI and distribution checks before publication. |
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.
Assets::parse_output()resolves every asset of every block on the page on disk for each uncached page view:glob()on the output directory,is_file(),filesize(),filemtime()andRuntime_Context::output_path()per asset, plus a recursive directory scan for CSS modules per block. On hosts with slowstat()(CageFS, network storage) this grows further.The runtime cache already describes these files, and its watch snapshot covers the source and the compiled file. This PR records what the render path reads (resolved file,
data-processed, size, both version keys) per asset, plus the CSS module files per block, when the build writes the runtime cache, after compiling and pruning the output directory. Cached requests read the records.render_tag()calls, and last-good payloads served while a peer rebuilds (their records may predate the changed sources, so they are dropped).blockstudio/files/url) andblockstudio/assets/disableare still resolved per request.Measured on WordPress 7.1.3, PHP 8.4 with OPcache, 28 blocks,
assets.output: cache,inlineLimiton. Forked in-process requests, ABAB, n=20 per run, medians:assetsmetric before → afterThe runtime cache file grows by about 4% (50.9 → 53.0 KB).
Tests:
AssetsTest(identicalparse_output()with and without records, inline limit on and off;render_tag()reads a record without touching the disk; module styles),BuildCacheTest(module styles are watched and required).