Skip to content

optimize anything using WriteString#85

Merged
whyrusleeping merged 2 commits intomasterfrom
feat/optimize-write-string
Aug 18, 2023
Merged

optimize anything using WriteString#85
whyrusleeping merged 2 commits intomasterfrom
feat/optimize-write-string

Conversation

@whyrusleeping
Copy link
Copy Markdown
Owner

The interface type assertion of io.WriteString was showing up pretty noticeably in some of my benchmarks, this makes that go away (almost) entirely. The benchmark in question went from around 3600ns/op to 3100ns/op.

Copy link
Copy Markdown
Collaborator

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

... if you say so

@whyrusleeping
Copy link
Copy Markdown
Owner Author

yeah i kinda didnt expect interface assertions to be expensive, but for 'map' style cbor objects youre writing a string every other field, and apparently the calls add up?

@Stebalien
Copy link
Copy Markdown
Collaborator

Yeah, it's one of those "compile time" v. "run time" tradeoffs the go devs made.

@whyrusleeping whyrusleeping merged commit f91ae53 into master Aug 18, 2023
@whyrusleeping whyrusleeping deleted the feat/optimize-write-string branch August 18, 2023 17:10
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