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
Closed

Builder.mapResult does not forward sizeHint #5577

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

Comments

@scabug
Copy link

scabug 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
Copy link
Author

scabug 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
Copy link
Author

scabug commented Mar 27, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants