JuliaDynamics / ResumableFunctions.jl

C# style generators a.k.a. semi-coroutines for Julia.
Other
160 stars 19 forks source link

significant regression in benchmarks #72

Closed Krastanov closed 1 year ago

Krastanov commented 1 year ago

The whole point of ResumableFunctions is that it is much faster than Base.Channel tasks. That is still somewhat true, but the benchmarks (described in the README) have experienced significant loss of performance (with Int types).

These two should basically be the same, but currently there is a significant difference:

Direct: 
  23.115 ns (0 allocations: 0 bytes)
ResumableFunctions: 
  3.487 μs (249 allocations: 3.89 KiB)

After this is fixed, we should also add these benchmarks to the CI and we should add the check for zero allocations as an explicit test.

gerlero commented 1 year ago

Well, this is bad.

we should also add these benchmarks to the CI and we should add the check for zero allocations as an explicit test.

Agreed.

pepijndevos commented 1 year ago

I bisected the performance regression to 727ba4aab8826d9a6fff9f332ab1179dfefbb39c

Krastanov commented 1 year ago

@gerlero , any chance you can investigate this? It is probably some type instability in the modified iterate method that was introduced when yieldfrom was merged.

gerlero commented 1 year ago

@pepijndevos thanks; that's #57 then. @Krastanov I'll take a look as soon as I can.