Created
July 8, 2016 12:05
-
-
Save taylonr/4e3c9084e8728771ce1b8b63bbf69d7f to your computer and use it in GitHub Desktop.
String Eval
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
def compare(conn, params) do | |
first = params["code"]["first_snippet"] | |
second = params["code"]["second_snippet"] | |
{val, _} = Code.eval_string("Benchee.init(%{time: 3}) | |
|> Benchee.benchmark('First', fn -> #{first} end) | |
|> Benchee.benchmark('Second', fn -> #{second} end) | |
|> Benchee.measure | |
|> Benchee.statistics | |
|> BencheeWeb.Formatter.to_map") | |
render conn, "compare.html", vals: val | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment