Repository navigation
Conversation
formatLog builds the formatted log once and assigns args and eventName only when there is an event name, instead of spreading a temporary object (or an empty one) into the result. Own args and eventName keys on the input keep their position, as before. Co-authored-by: jxom <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-01a1e1b3-ce83-72d3-b448-f29dd09b6e57
🦋 Changeset detectedLatest commit: e942535 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Published |
|
Bundled into #5543 as its own commit, so this PR is superseded. Closing in favour of the bundle. |
Speeds up
formatLog(B8 from the perf audit). Outputs and errors are unchanged.Changes
formatLogbuilds the formatted log once. It assignsargsandeventNameonly wheneventNameis set, instead of spreading{ args, eventName }(or{}) into the literal.args/eventNamekeys keeps them in the same position, and their values are overwritten, as with the spread.eventNameadds nothing.src/utils/formatters/log.bench.ts:getLogs/getFilterLogspath)watchEventpath)formatTransactionReceiptwith 500 logsBenchmarks
SKIP_GLOBAL_SETUP=true ./node_modules/.bin/vitest bench -c ./test/vitest.config.ts --project core --run src/utils/formatters/log.bench.ts,origin/mainvs this branch (ops/s), 2 runs:formatTransactionReceipt, 500 logsThe audit's 1.25× also replaced the
mapinformatTransactionReceiptwith a loop. This PR keeps toformatLog. The rest of the time goes to the...logspread itself, which must stay to keep unknown fields and their order.Correctness
origin/main: a scratch harness compared own keys in order (Reflect.ownKeys, so symbol keys too), values, and errors against a copy of theorigin/mainmodule.args,eventNameand unknown keys, with malformed values (symbols, bigints, objects, invalid hex), an own__proto__key, and everyargs/eventNameoption combination.eventNamekey, formatted with and without an event name. The snapshot (key order included) was written againstorigin/main.src/utils/formatters,getLogs,getFilterLogs,getFilterChanges,watchEvent,watchContractEvent,parseEventLogsandgetTransactionReceiptpass (15 files, 218 tests).tsconsrcpasses.Size
Within the current limits. Other perf PRs (#5525, #5532, #5533, #5539, #5540, #5541) bump the same limits, so whichever lands later may need a rebase there.