-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(gnolang): make print+println much more efficient #3952
base: master
Are you sure you want to change the base?
perf(gnolang): make print+println much more efficient #3952
Conversation
de2c4ec
to
0465c4f
Compare
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
962a214
to
e45a75c
Compare
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
remove: review/triage-pending
flag
9214dcf
to
847eef7
Compare
This change is the result of seeing print/println being reported in bugs as needing gas metering but on examination, noticed that the code causes a RAM and CPU bloat, so this makes an improvement in all dimensions by invoking: * io.WriteString(m.Output, segments) instead of m.Output.Write([]byte(segments)) * in cases where `!debug`, we don't need to construct the concatenated string delimited by " " and can instead write the Sprint-ed string segments as we encounter them ```shell $ benchstat before_println.txt after_println3.txt name old time/op new time/op delta GnoPrintln-8 1.94ms ± 2% 1.86ms ± 4% -4.02% (p=0.001 n=9+9) name old alloc/op new alloc/op delta GnoPrintln-8 1.92MB ± 0% 1.81MB ± 0% -5.92% (p=0.000 n=10+10) name old allocs/op new allocs/op delta GnoPrintln-8 19.0k ± 0% 16.0k ± 0% -15.76% (p=0.002 n=8+10) ``` Fixes gnolang#3951
847eef7
to
4bcd6ab
Compare
This change is the result of seeing print/println being reported in bugs as needing gas metering but on examination, noticed that the code causes a RAM and CPU bloat, so this makes an improvement in all dimensions by invoking:
!debug
, we don't need to construct the concatenatedstring delimited by " " and can instead write the Sprint-ed string
segments as we encounter them
Fixes #3951