Is this expected that calling `myRawSource.buffere...
# io
h
Is this expected that calling
myRawSource.buffered().buffered().buffered()
creates a new RealSource each time? Shouldn't be there an extension on
Source.buffered() = this
?
f
There were arguments agains an optimization returning
this
for
Source.buffered()
(https://github.com/Kotlin/kotlinx-io/pull/136#issuecomment-1604125718). As per https://github.com/Kotlin/kotlinx-io/issues/146, a separate set of extensions could be added to achieve optimized behavior. However, it seems like #146 didn't attract a lot of interest from anyone, so nothing was done so far.
h
Thanks for the links, so it is „okay“ to create multiple buffers and I can ignore the small overhead. I am creating a server framework that should be run „inside“ an Apache Camel environment as well as Ktor, and Camel supports an Input/Output Stream vs Ktor provides an Source/Sink so for convince the generated code will contain buffered
f
If the overhead will not be neglectible, you can drop a few words in the issue I referred before, and we'll figure out what should be done: either add new optimized extensions, or change behavior of existing ones.
h
The overhead is neglectible.