Skip to content

perf: metadata caching & hot path optimisations#2665

Open
matthew2564 wants to merge 6 commits intotypestack:developfrom
matthew2564:perf/package-optimisation
Open

perf: metadata caching & hot path optimisations#2665
matthew2564 wants to merge 6 commits intotypestack:developfrom
matthew2564:perf/package-optimisation

Conversation

@matthew2564
Copy link

@matthew2564 matthew2564 commented Feb 16, 2026

Description

  • Series of performance optimisations. Benchmarked develop and then re-run on branch. All 700+ tests passing.

So the flow was:

  1. Create benchmark.ts on this branch
  2. git stash
  3. Run benchmark → baseline numbers
  4. git stash pop
  5. Run benchmark
Screenshot 2026-02-16 at 09 52 16

Checklist

  • the pull request title describes what this PR does (not a vague title like Update index.md)
  • the pull request targets the default branch of the repository (develop)
  • the code follows the established code style of the repository
    • npm run prettier:check passes
    • npm run lint:check passes
  • tests are added for the changes I made (if any source code was modified)
  • [] documentation added or updated
  • I have run the project locally and verified that there are no errors

@matthew2564
Copy link
Author

@braaar I've hopefully now fixed the issues detected in the pipeline (formatting & missing test cov) 👍

Comment on lines 17 to 25
for (const key in value ) {
if ((value ).hasOwnProperty(key)) {
const propertyValue = (value as any)[key];
if (propertyValue !== null && propertyValue !== undefined) {
return true;
}
}
}
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you certain this is faster than the original, or did you make all the chances at once and then benchmark it all in bulk?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The for in approach is faster because it avoids allocating an intermediate array (like Object.values() does) and can short-circuit as soon as it finds a non-null/undefined value

@braaar
Copy link
Member

braaar commented Feb 25, 2026

Could you fix the merge conflicts?

@braaar
Copy link
Member

braaar commented Feb 26, 2026

Could you go over the tests to increase the coverage a bit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants