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
Code.toBytes() creates an instance of ByteArrayOutputStream() which in turn creates default byte[32] in its constructor.
Every time the current capacity is exhausted the underlying array is doubled in size and copied over, which has visible performance impact. That could be avoided by properly sizing the instance at creation.
Solution
Either a better default size could be used universally (256? 512?) or the actual size of item could be computed and passed to ByteArrayOutputStream(int). Performance effect of either solution should be evaluated.
Alternatives
No response
The text was updated successfully, but these errors were encountered:
Problem
Code.toBytes()
creates an instance ofByteArrayOutputStream()
which in turn creates defaultbyte[32]
in its constructor.Every time the current capacity is exhausted the underlying array is doubled in size and copied over, which has visible performance impact. That could be avoided by properly sizing the instance at creation.
Solution
Either a better default size could be used universally (256? 512?) or the actual size of
item
could be computed and passed toByteArrayOutputStream(int)
. Performance effect of either solution should be evaluated.Alternatives
No response
The text was updated successfully, but these errors were encountered: