mdedetrich commented on PR #2262: URL: https://github.com/apache/pekko/pull/2262#issuecomment-3324392535
> Why not use a Scala Vector? Scala's vector is extremely slow for small collection sizes (see https://www.lihaoyi.com/post/BenchmarkingScalaCollections.html#conclusion). The only areas where Vectors are worth it is in multi-threaded/concurrent scenarios and you are dealing with large collection sizes (unlike other immutable collections such as java's `String`, Vector is triemap based so it doesn't need to copy the entire collection and it being immutable makes concurrency trivial as you are always making a new reference). This is why `ByteString` shines, its backed by a Scala vector but due to the fact that we are dealing with large sizes (http responses/requests can be quite big) and its used in situations where concurrency is needed (we don't want a purely single threaded http client/server). tl;dr is, especially if you don't need to care about concurrency just use standard array/arraybuffer etc etc depending on your requirements, its going to be much faster than Vector. > @mdedetrich wdyt about this? Ill look into it in a bit but at first glance this is a non controversial performance improvement -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
