Skip to content

Improve preview speed#8750

Open
ClementPasteau wants to merge 5 commits into
masterfrom
improve-preview-speed
Open

Improve preview speed#8750
ClementPasteau wants to merge 5 commits into
masterfrom
improve-preview-speed

Conversation

@ClementPasteau

Copy link
Copy Markdown
Collaborator

No description provided.

@ClementPasteau ClementPasteau requested a review from 4ian as a code owner June 22, 2026 12:15
ClementPasteau and others added 2 commits June 22, 2026 14:17
These synthetic benchmarks complement scripts/profile-events-code-generation.js
(which profiles a real project) by isolating how resource finding and events
code generation scale with project size, making perf regressions easy to spot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ClementPasteau ClementPasteau changed the title Improvements of lookup of objects metadata speeding up preview Improve preview speed Jun 22, 2026
ClementPasteau and others added 2 commits June 22, 2026 17:06
…pe caches

Introduce gd::PlatformMetadataIndex, a hash-map index of all metadata declared
by a platform's extensions, built lazily and owned by gd::Platform. It is
discarded whenever extensions change (Platform::AddExtension / RemoveExtension,
which also covers replacement/regeneration), so it never returns stale
metadata. Lookup semantics are unchanged (first extension wins; object/behavior
expressions resolve the specific type before the base).

This replaces the per-code-generation caches added earlier:
- the object-metadata cache is now redundant (MetadataProvider is O(1));
- the object-type cache only helped pathological object groups and had no
  measurable effect on real projects, so it is removed for simplicity.

Fixing the lookup at the source instead measurably speeds up resource finding
(per-instruction metadata lookups) and any project with many extensions, where
the previous O(extensions) scan grew without bound.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Core/tests/PlatformMetadataIndex.cpp (native/catch): every lookup kind against
  DummyPlatform, object-expression fallback to the base ("") type, behavior
  actions indexed alongside free/object ones, bad-metadata for unknown types,
  the declaring extension is returned, and the index rebuilds after an extension
  is removed.
- Expand the jest MetadataProviderIndex test to assert *all* metadata kinds
  resolve after an extension is added and *all* become bad after it is removed
  (invalidation covers the whole index, not just objects/actions).

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