bencheeorg / benchee

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

Benchee throws an exception when running in the Livebook-App #367

Closed NickNeck closed 1 year ago

NickNeck commented 2 years ago

Hello

Benchee runs great in Livebook, but raises an exception in the Livebook-App.

In the Livebook-App the file Path.join([:code.root_dir(), "releases", otp_release, "OTP_VERSION"]) is not available.

Maybe Benchee.System.erlang/0 could return otp_release as a fallback.

PragTob commented 2 years ago

Huh, thanks for the report. Guess I have to get playing with live book. Weird that it isn't there but yeah... that this is the way to get the OTP version is still very sad.

We can do that, we rely on the correct version for some switches in logic though (sadly). But well, better than crashing.

NickNeck commented 2 years ago

@PragTob if you want to play with Livebook you can give benchee_dsl.livemd a try. I borrowed some lines from your readme for the notebook.

zorbash commented 2 years ago

A quick workaround to prevent the crash is:

otp_release = :erlang.system_info(:otp_release)
File.mkdir_p!(Path.join([:code.root_dir(), "releases", otp_release]))

Path.join([:code.root_dir(), "releases", otp_release, "OTP_VERSION"])
|> File.write!("25.0")

The OTP version of the most recent livebook app seems to be 25.0 link.