perf(expect): avoid redefining matcher state - #11048
Conversation
Only apply incoming descriptors and initialize the WeakMap entry once. Co-Authored-By: Codex <noreply@openai.com>
|
Hello @scttcper. Your PR has been labeled To keep your PR open, please follow these steps:
Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like Google Translate or Deepl. If the response is generated, the PR will be closed automatically. These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context. |
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
i'm a human watching codex/chatgpt profile a few things. found this small change to expect that should hopefully be pretty straight forward and i have reviewed. Very much a microbenchmark but should be small enough change to go with it. edit: failing test looks like a flake |
|
LGTM 👍 |
Codex assisted with this PR; I reviewed the changes and benchmark results.
Every
expect(value)updatesassertionCalls, butsetStatewas redefining every existing state property and writing the same object back to its WeakMap. This applies only the incoming patch descriptors and inserts state into the map only during initialization, while preserving getters such astestPath.expect(value)Measured on Node 26.7.0 with 10 samples of 250,000 calls after a 50,000-call warmup.