Last active
June 14, 2016 18:09
-
-
Save ismaelga/36992b2150421307743a47113042afcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule AppendBench do | |
use Benchfella | |
@list Enum.into 1..10000, [] | |
bench "++" do | |
h = Enum.at @list, 0 | |
@list ++ [h] | |
end | |
bench "List.insert_at" do | |
h = Enum.at @list, 0 | |
List.insert_at @list, -1, h | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Settings:
duration: 1.0 s
AppendBench
[19:01:09] 1/2: List.insert_at
[19:01:12] 2/2: ++
Finished in 7.31 seconds
AppendBench
++ 50000 64.73 µs/op
List.insert_at 10000 298.41 µs/op