GsDevKit / zinc

Zinc HTTP Components is an open-source Smalltalk framework to deal with the HTTP networking protocol.
MIT License
4 stars 10 forks source link

Performance issue of ZnBivalentWriteStream>>#next:putAll:startingAt: when writing from a large collection #104

Closed jbrichau closed 5 months ago

jbrichau commented 5 months ago

The ZnBivalentWriteStream>>#next:putAll:startingAt: collection argument is converted to a ByteArray or a String when needed.

See https://github.com/GsDevKit/zinc/blob/01210a4d602d90c65d2356cbff86012fbdffde85/repository/Zinc-HTTP.package/ZnBivalentWriteStream.class/instance/next.putAll.startingAt..st#L10

However, the entire collection is converted even though only a part of the entire collection is to be written. Since this method is used in the ZnResponse>>writeOn: through ZnUtils>>nextPutAll:on:, which splits the writing of a large collection into chunks of 16kB, the writing of a large response suffers from a severe performance penalty.

See https://lists.gemtalksystems.com/mailman/archives/glass/2024-May/006674.html