You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Builder.mapResult
returns an anonymous proxy that forwards most method calls to the target builder and overridesresult
to apply a function to the target Builder's result. Unfortunately this proxy does not forwardsizeHint
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.
The text was updated successfully, but these errors were encountered: