Skip to content

[3.3.0] Performance regression #2634

@iRevive

Description

@iRevive

This issue was originally created in fs2, so version numbers below refer to fs2.

I've observed a performance degradation in some scenarios on 3.2.3 version.

The throughput on small byte streams remained the same.
The throughput on bigger byte streams is decreased roughly by ~20%.
The memory allocation decreased by 10-15% on bigger byte streams.

See the benchmarks below for more details.

Stream usage

The project utilizes a TCP socket from the fs2-io module. I cannot share many details due to NDA, but the generalized usage of the socket is the following one:

val streamDecoder: StreamDecoder[Structure] =
  StreamDecoder.many(StructureDecoder)

socket.reads
  .through(streamDecoder.toPipeByte)
  .evalMap(structure => queue.offer(Right(structure)))
  .compile
  .background

Consumed bytes per single invocation:

  • createOne: 167 bytes
  • returnRandomUUID: 135 bytes
  • return100Record: 2683 bytes

3.2.2

Operation average time:

Benchmark                           Mode  Cnt   Score        Error   Units
DriverBenchmark.createOne           avgt   25   4.725 ±      0.396   ms/op
DriverBenchmark.return100Records    avgt   25   8.613 ±      0.488   ms/op
DriverBenchmark.returnRandomUUID    avgt   25   3.542 ±      1.156   ms/op

Memory allocation:

DriverBenchmark.return100Records:·gc.alloc.rate                        201.323 ±     11.576  MB/sec
DriverBenchmark.return100Records:·gc.alloc.rate.norm               3117144.635 ±  13036.746    B/op
DriverBenchmark.return100Records:·gc.churn.G1_Eden_Space               199.083 ±     23.093  MB/sec
DriverBenchmark.return100Records:·gc.churn.G1_Eden_Space.norm      3076695.652 ± 283692.848    B/op
DriverBenchmark.return100Records:·gc.churn.G1_Old_Gen                    0.074 ±      0.113  MB/sec
DriverBenchmark.return100Records:·gc.churn.G1_Old_Gen.norm            1266.657 ±   1981.461    B/op
DriverBenchmark.return100Records:·gc.churn.G1_Survivor_Space             0.484 ±      0.444  MB/sec
DriverBenchmark.return100Records:·gc.churn.G1_Survivor_Space.norm     7614.493 ±   6998.312    B/op
DriverBenchmark.return100Records:·gc.count                              72.000               counts
DriverBenchmark.return100Records:·gc.time                              300.000                   ms

3.2.3

Operation average time:

Benchmark                           Mode  Cnt   Score        Error   Units
DriverBenchmark.createOne           avgt   25   4.862 ±      0.414   ms/op
DriverBenchmark.return100Records    avgt   25  11.008 ±      0.356   ms/op
DriverBenchmark.returnRandomUUID    avgt   25   3.068 ±      0.299   ms/op

Memory allocation:

DriverBenchmark.return100Records:·gc.alloc.rate                        169.961 ±      6.376  MB/sec
DriverBenchmark.return100Records:·gc.alloc.rate.norm               3383113.516 ±  12432.017    B/op
DriverBenchmark.return100Records:·gc.churn.G1_Eden_Space               175.288 ±     24.073  MB/sec
DriverBenchmark.return100Records:·gc.churn.G1_Eden_Space.norm      3484911.125 ± 432781.648    B/op
DriverBenchmark.return100Records:·gc.churn.G1_Old_Gen                    0.061 ±      0.075  MB/sec
DriverBenchmark.return100Records:·gc.churn.G1_Old_Gen.norm            1224.015 ±   1529.533    B/op
DriverBenchmark.return100Records:·gc.churn.G1_Survivor_Space             0.484 ±      0.566  MB/sec
DriverBenchmark.return100Records:·gc.churn.G1_Survivor_Space.norm     9489.291 ±  11071.370    B/op
DriverBenchmark.return100Records:·gc.count                              56.000               counts
DriverBenchmark.return100Records:·gc.time                              433.000                   ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions