Skip to content
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

sql: use a string builder in decodeCopy #52250

Merged
merged 1 commit into from
Aug 3, 2020
Merged

sql: use a string builder in decodeCopy #52250

merged 1 commit into from
Aug 3, 2020

Conversation

maddyblue
Copy link
Contributor

For returning strings, a string builder is better than a bytes buffer.

name                  old time/op    new time/op    delta
DecodeCopySimple-12     10.8ns ± 1%    10.6ns ± 1%   -2.03%  (p=0.024 n=5+5)
DecodeCopyEscaped-12     249ns ± 1%     178ns ± 2%  -28.71%  (p=0.008 n=5+5)

name                  old alloc/op   new alloc/op   delta
DecodeCopySimple-12      0.00B          0.00B          ~     (all equal)
DecodeCopyEscaped-12     96.0B ± 0%     40.0B ± 0%  -58.33%  (p=0.008 n=5+5)

name                  old allocs/op  new allocs/op  delta
DecodeCopySimple-12       0.00           0.00          ~     (all equal)
DecodeCopyEscaped-12      2.00 ± 0%      2.00 ± 0%     ~     (all equal)

Release note: None

For returning strings, a string builder is better than a bytes buffer.

```
name                  old time/op    new time/op    delta
DecodeCopySimple-12     10.8ns ± 1%    10.6ns ± 1%   -2.03%  (p=0.024 n=5+5)
DecodeCopyEscaped-12     249ns ± 1%     178ns ± 2%  -28.71%  (p=0.008 n=5+5)

name                  old alloc/op   new alloc/op   delta
DecodeCopySimple-12      0.00B          0.00B          ~     (all equal)
DecodeCopyEscaped-12     96.0B ± 0%     40.0B ± 0%  -58.33%  (p=0.008 n=5+5)

name                  old allocs/op  new allocs/op  delta
DecodeCopySimple-12       0.00           0.00          ~     (all equal)
DecodeCopyEscaped-12      2.00 ± 0%      2.00 ± 0%     ~     (all equal)
```

Release note: None
@maddyblue maddyblue requested review from otan and arulajmani August 3, 2020 15:58
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@maddyblue
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 3, 2020

Build succeeded:

@craig craig bot merged commit e36a617 into cockroachdb:master Aug 3, 2020
@maddyblue maddyblue deleted the decode-string branch August 3, 2020 18:48
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.

3 participants