Created
June 24, 2025 20:51
-
-
Save Nezteb/7b8d1061e3ea1739e4de1b9307c9d01b to your computer and use it in GitHub Desktop.
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
# Test with different integer sizes | |
small_int = 42 | |
medium_int = 123_456 | |
large_int = 9_876_543_210 | |
small_str = "42" | |
medium_str = "123456" | |
large_str = "9876543210" | |
Benchee.run( | |
%{ | |
"Small Int -> String" => fn -> Integer.to_string(small_int) end, | |
"Small String -> Int" => fn -> String.to_integer(small_str) end, | |
"Medium Int -> String" => fn -> Integer.to_string(medium_int) end, | |
"Medium String -> Int" => fn -> String.to_integer(medium_str) end, | |
"Large Int -> String" => fn -> Integer.to_string(large_int) end, | |
"Large String -> Int" => fn -> String.to_integer(large_str) end | |
}, | |
time: 5, | |
memory_time: 2, | |
warmup: 2 | |
) |
Author
Nezteb
commented
Jun 25, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment