Conversation
Stream removes some of the overhead jitter of Enum, and having a control test helps one understand what the overhead of the test itself is versus what sort of time is being spent in EctoSQL modules
| 1..100_000 | ||
| |> Enum.map(fn _ -> %{name: "Alice", uuid: Ecto.UUID.bingenerate()} end) | ||
| |> Stream.map(fn _ -> %{name: "Alice", uuid: Ecto.UUID.bingenerate()} end) | ||
| } |
There was a problem hiding this comment.
I would keep on using Enum, because it is likely that you will spend even more time on streams (streams are more CPU intensive, less memory intensive). Enum will use more memory but it is allocated outside of the benchmark.
Another suggestion is to use Enum.each in the benchmarks below.
There was a problem hiding this comment.
Good point! Enum.each is slightly faster here than Stream.map |> Stream.run (though Enum.map is considerably slower, probably due to allocations and building rather large lists).
My goal with this change was to minimize the amount of overhead there is in the tests so improvements to performance are more visible and don't get lost in "noise" due to overhead dominating too much.
See b98e6ac
josevalim
left a comment
There was a problem hiding this comment.
One comment and we can ship it!
|
💚 💙 💜 💛 ❤️ |
Currently, the benchmarks do not run due to changes in Benchee (specifically the removals of
formatter_options). This PR brings the benchmark code up to par with current Bench and: