http402
Benchmark Calls from IEx vs Mix Tasks
If I have a mix project with two libraries that I want to comparatively benchmark - is it fair to call each of them one at a time from an IEx shell (started with iex -S mix) and compare their execution times? Is this significantly different than say, making a mix task, and running it? How much of the IEx experience is interpreted rather than compiled?
Most Liked
net
bbense
In any VM environment benchmarking is very tricky, you never know if you are benchmarking your actual code or the implementation of the VM. You really need to do many invocations and do a statistical analysis. Using :tc.timer in iex can provide very misleading results.env MIX_ENV=prod also effects the timing results.
Benchee , Benchfella and other similar libraries help, but even with those there are some gotchas. If you are simply looking for order of magnitude results, then :tc.timer in iex is probably ok, but I would not trust it beyond that.
OvermindDL1
I may be wrong, but I think iex is entirely interpreted.
Do note, that means that defmodule’ing inside iex will interpret the defmodule call, but that really does compile a module and code run ‘inside’ those functions are fast.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








