Skip to content

Performance: screen-gate assets, cache hot paths, asset bug fixes#471

Draft
cbravobernal wants to merge 1 commit into
trunkfrom
perf/runtime-asset-safe
Draft

Performance: screen-gate assets, cache hot paths, asset bug fixes#471
cbravobernal wants to merge 1 commit into
trunkfrom
perf/runtime-asset-safe

Conversation

@cbravobernal

Copy link
Copy Markdown
Contributor

Lower-risk half of the performance audit, split out from #466 so it can be reviewed and merged without waiting on multilingual testing. The sibling-field priming (the one change that touches the field-value load path and interacts with WPML/Polylang/ACFML) is in its companion PR. Everything here is behavior-identical or a straight bug fix.

PHP runtime

  • Per-request cache for acf_get_option_meta(), invalidated via core option hooks. Keeps the esc_like() hardening from Use esc_like() when building option-meta LIKE patterns #462 — the cache wraps that query, it does not revert it.
  • Decode each local JSON file once per request instead of 4× (includes/local-json.php): ~44ms → ~16ms at 200 files.
  • acf_decode_taxonomy_term(): raw SQL → get_term().
  • Blocks save-path early bail when no block types are registered.
  • Gate the escaped-html notice script to when the notice renders.
  • Memoize the WP version check in acf_is_using_datastore().

Assets / enqueue

  • scf-bindings moved to enqueue_block_editor_assets (was pulling the wp-editor stack onto classic admin + front-end acf_form pages).
  • Command-palette scripts gated on wp-commands being enqueued.
  • Drop wp-polyfill from all handles (webpack injectPolyfill). Compiled assets are gitignored and rebuilt at release (bin/prepare-release.php), so this takes effect on the next release build.
  • Fix pro CSS min suffix (production was shipping unminified CSS).
  • Gate acf-pro-ui-options-page with is_admin().
  • Fix acf-dark stylesheet 404.
  • Trim release zip (exclude assets/src + source maps): −4.2 MB.

Verification

  • composer test:php: OK (2823 tests, 21565 assertions). npm run test:unit: 951. composer test:phpstan: clean.
  • New code stamped @since SCF 6.9.0 (6.8.9 already shipped without it).

See #466 (superseded by this PR + the sibling-priming PR).

Use of AI Tools

Initial implementation by Claude Code (Claude Fable 5) under human direction; split, reviewed and revised by Claude Code (Claude Opus 4.8). All changes human-reviewed.

Lower-risk half of the performance audit (sibling-field priming is split
into its own PR for focused review). Everything here is behavior-identical
or a straight bug fix.

PHP runtime:
- Per-request cache for acf_get_option_meta(), invalidated via core option
  hooks (keeps the esc_like() hardening from #462; the cache wraps it).
- Decode each local JSON file once per request instead of 4x.
- acf_decode_taxonomy_term(): raw SQL -> get_term().
- Early bail in the blocks save path when no block types are registered.
- Gate the escaped-html notice script to when the notice renders.
- Memoize the WP version check in acf_is_using_datastore().

Assets / enqueue:
- Move scf-bindings to enqueue_block_editor_assets (was pulling the
  wp-editor stack onto classic admin + front-end acf_form pages).
- Gate command-palette scripts on wp-commands being enqueued.
- Drop wp-polyfill from all handles (webpack injectPolyfill).
- Fix pro CSS min suffix (production shipped unminified CSS).
- Gate acf-pro-ui-options-page with is_admin().
- Fix acf-dark stylesheet 404.
- Trim release zip (exclude assets/src + source maps): -4.2 MB.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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