Last active
October 6, 2017 14:27
-
-
Save gootik/cf3a540137364a61caab3b2acea4f9b1 to your computer and use it in GitHub Desktop.
Testing map timing
This file contains hidden or 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
-module(test). | |
-compile([export_all]). | |
map_time() -> | |
Map = #{a => true, | |
b => true, | |
c => true, | |
p => true, | |
e => true, | |
x => true}, | |
TestList = [a, b, c, c, d, a, a, b, c, c, d, a, a, b, c, c, d, a, | |
e, f, g, h, i, i, j, k, c, c, l, l, a, p, o, m, d, a], | |
Counter = lists:seq(0, 20000), | |
Start = os:timestamp(), | |
[begin | |
lists:filter( | |
fun(I) -> | |
maps:is_key(I, Map) | |
end, TestList) | |
end || _ <- Counter], | |
End = os:timestamp(), | |
io:format(user, "Took ~pms to run~n", [timer:now_diff(End,Start) / 1000]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment