bencheeorg / benchee

Easy and extensible benchmarking in Elixir providing you with lots of statistics!
MIT License
1.41k stars 66 forks source link

Memory usage optimization / avoid sending unneeded data to parallel processing #408

Closed PragTob closed 9 months ago

PragTob commented 9 months ago

Should combat memory consumption issues caused by sending too much data to processes.

edit: To highlight the severeness of this:

I wanna write up all of this in like 2 blog posts but as per usual my speed is abysmal 😁

PragTob commented 9 months ago

Mental notes:

  1. We can be even more efficient for the most common case of just 1 formatter if we just don't do any parallel processing in that case, difference is small but exists and should be an easy fix:
Name                        ips        average  deviation         median         99th %
sequential_output        240.79        4.15 ms     ±5.70%        4.13 ms        4.34 ms
format & write           240.00        4.17 ms     ±3.71%        4.13 ms        4.82 ms
Formatter.output         228.23        4.38 ms    ±16.58%        4.07 ms        6.34 ms

Comparison: 
sequential_output        240.79
format & write           240.00 - 1.00x slower +0.0138 ms
Formatter.output         228.23 - 1.06x slower +0.23 ms
  1. might want to provide "input_names" to use instead of the broken list :eyes:

  2. adjust docs & Changelog

PragTob commented 9 months ago

:partying_face:

Name                        ips        average  deviation         median         99th %
Formatter.output         248.71        4.02 ms     ±4.58%        4.03 ms        4.59 ms
sequential_output        248.38        4.03 ms     ±3.16%        4.00 ms        4.53 ms
format & write           247.77        4.04 ms     ±6.76%        4.02 ms        4.35 ms

Comparison: 
Formatter.output         248.71
sequential_output        248.38 - 1.00x slower +0.00539 ms
format & write           247.77 - 1.00x slower +0.0153 ms
PragTob commented 9 months ago

I definitely should get exguard working again... the amount of force pushes due to minor credo things are embarrassing ._.

PragTob commented 9 months ago

:wave: Hey @hrzndhrn @NickNeck as you have some of the most Benchee plugins I'd appreciate it if you took a look here, mainly from the PoV on impact for plugins. If you want to review the PR as a whole of course I'm happy too :grin:

TLDR;

Thanks!

NickNeck commented 9 months ago

@PragTob thanks for the hint. Thanks for Benchee and all your work. I will take a look during the weekend.

PragTob commented 9 months ago

@NickNeck thanks for all your great OSS work and also specifically of creating Benchee plugins, it was designed to facillitate and allow this but seeing all the things people do warms my heart! 💚

PragTob commented 9 months ago

@NickNeck thanks a lot! :green_heart:

IMG_20220705_184557