Skip to content

Commit

Permalink
Optimise conversion from Blob to Stream (#1609)
Browse files Browse the repository at this point in the history
* Optimise conversion from Blob to Stream

Motivated by http4s/http4s#7539

* Updated changelog
  • Loading branch information
Baccata authored Oct 14, 2024
1 parent ae5b9de commit ec140e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ When adding entries, please treat them as if they could end up in a release any

Thank you!

# 0.18.26

* Optimises the conversion of empty smithy4s.Blob to fs2.Stream, to avoid performance degradation in Ember (see [#1609](https://github.com/disneystreaming/smithy4s/pull/1609))

# 0.18.25

* Add A flag to allow for numerics to be decoded from JSON strings (in smithy4s-json).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ package object kernel {

private def toStream[F[_]](
blob: Blob
): Stream[F, Byte] = Stream.chunk(Chunk.array(blob.toArray))
): Stream[F, Byte] =
// Optimisation motivated by https://github.com/http4s/http4s/issues/7539
if (blob.isEmpty) Stream.empty else Stream.chunk(Chunk.array(blob.toArray))

}

0 comments on commit ec140e5

Please sign in to comment.