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

Builder.mapResult does not forward sizeHint #5577

Closed
scabug opened this issue Mar 16, 2012 · 2 comments

Comments

@scabug
Copy link

commented Mar 16, 2012

Builder.mapResult returns an anonymous proxy that forwards most method calls to the target builder and overrides result to apply a function to the target Builder's result. Unfortunately this proxy does not forward sizeHint and related methods. This causes excessive copying and oversized buffer allocations when mapped Builders are used (ArraySeq uses a mapped Builder so this situation is not uncommon).

The fix is easy: add
def sizeHint(size: Int) = self.sizeHint(size)
to the mapResult proxy.

@scabug

This comment has been minimized.

Copy link
Author

commented Mar 16, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5577?orig=1
Reporter: Chris Sachs (c9r)
Affected Versions: 2.9.1, 2.10.0-M2

@scabug

This comment has been minimized.

Copy link
Author

commented Mar 27, 2012

@adriaanm said:
alex, please re-assign if needed

@scabug scabug closed this May 4, 2012

@scabug scabug added the enhancement label Apr 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.