Advent of Code with OTP 24

Please warn me if I got something wrong :grinning_face_with_smiling_eyes:

I did some shallow benchmarking on the first day of AoC and couldn’t believe the performance difference.

erlang 22.3.4.4
elixir 1.10.2-otp-22

Q1 ran 1000 times with an average of 0.15918899999999975ms
Q2 ran 1000 times with an average of 0.47954400000000347ms

erlang 23.2.3
elixir 1.11.3-otp-23

Q1 ran 1000 times with an average of 0.13871999999999998ms
Q2 ran 1000 times with an average of 0.42693799999999826ms

erlang 24.1.7
elixir 1.12.3-otp-24

Q1 ran 1000 times with an average of 0.05861299999999995ms
Q2 ran 1000 times with an average of 0.09286299999999992ms

Here’s my runner if anyone is interested. You can run benchmarks with passing -b arg like elixir challenges/2021/01.exs -b 1000 (AoC spoilers in repo)

4 Likes

Yeah, that’s the JIT and it is awesome. It won’t make everything 2x or 3x faster, but that speed up is also not unheard of. :slight_smile:

7 Likes

You might like the explanation of @garazdawi

5 Likes