Skip to content

perf: improve performance of emit() - #70

Merged
Uzlopak merged 1 commit into
masterfrom
perf-optimize
Dec 4, 2022
Merged

perf: improve performance of emit()#70
Uzlopak merged 1 commit into
masterfrom
perf-optimize

Conversation

@Uzlopak

@Uzlopak Uzlopak commented Dec 4, 2022

Copy link
Copy Markdown
Contributor

Follow Up of #69

As @climba03003 correctly concluded, checking first if we already emitted the warning is actually the performance gain. So we put that to the fast-path.

before:

uzlopak@Battlestation:~/workspace/fastify-org/process-warning$ node benchmarks/warn.js
warn x 40,120,473 ops/sec ±0.64% (98 runs sampled)
(node:9821) [FST_ERROR_CODE_1] FastifyWarning: message
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9821) [FST_ERROR_CODE_3] FastifyWarning: message

after:

uzlopak@Battlestation:~/workspace/fastify-org/process-warning$ node benchmarks/warn.js
warn x 90,812,134 ops/sec ±0.27% (94 runs sampled)
(node:9882) [FST_ERROR_CODE_1] FastifyWarning: message
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9882) [FST_ERROR_CODE_3] FastifyWarning: message

Checklist

@Uzlopak Uzlopak mentioned this pull request Dec 4, 2022
4 tasks
@Uzlopak
Uzlopak requested a review from mcollina December 4, 2022 21:40

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@Uzlopak
Uzlopak merged commit 005053d into master Dec 4, 2022
@Uzlopak
Uzlopak deleted the perf-optimize branch December 4, 2022 22:08
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.

2 participants