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

Serious performance regression in Grow method of OutputBuffer #1065

Closed
eitanhs opened this issue Aug 6, 2020 · 1 comment
Closed

Serious performance regression in Grow method of OutputBuffer #1065

eitanhs opened this issue Aug 6, 2020 · 1 comment

Comments

@eitanhs
Copy link
Contributor

eitanhs commented Aug 6, 2020

Recently, in order to mitigate CVE-2020-1469, among other changes, line 224 of OutputBuffer class
changed from length += length >> 1; to length = checked(length + length >> 1);
This actually doesn't change the value in length variable, because the + operator precedes the bit-shift operator,
So basically we multiply and divide == no change.
This causes serious performance regression as the underlying buffer grows by single value at a time (instead of growing by half of current size)...

I'll open a PR with a fix suggestion soon.

@chwarr
Copy link
Member

chwarr commented Aug 6, 2020

Nice find! Fix merged into master.

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 a pull request may close this issue.

2 participants