johnmyleswhite/Benchmark.jl — pull request #1 by diegozea (2013-01-06 05:53:00+00:00)
Title: Add method/macro for comparing two functions/expressions

Example use and output:

```
julia> e1 = quote
for i in 1:100
sum([1:10])
end
end
quote # line 2:
for i = 1:100 # line 3:
sum([1:10])
end
end

julia> e2 = quote
for i in 1:10
sum([1:10])
end
end
quote # line 2:
for i = 1:10 # line 3:
sum([1:10])
end
end

julia> @benchmark(e1,e2,"compare","mil","cien",300)
2x12 DataFrame:
BenchmarkCategory BenchmarkName Iterations TotalWall AverageWall MaxWall MinWall Timestamp JuliaVersion JuliaHash CodeHash OS
[1,] "compare" "mil" 283 1.40667e-5 4.97056e-8 1.19209e-6 0.0 "2013-01-06 02:46:02" "0.0.0+106299916.rdf56" "df564000a7" NA "Linux"
[2,] "compare" "cien" 317 1.28746e-5 4.06139e-8 1.90735e-6 0.0 "2013-01-06 02:46:02" "0.0.0+106299916.rdf56" "df564000a7" NA "Linux"

julia> function f()
sum([1:1000])
end

julia> function g()
sum([1:100])
end

julia> benchmark(f,g,"ej","mil","cien",300)
2x12 DataFrame:
BenchmarkCategory BenchmarkName Iterations TotalWall AverageWall MaxWall MinWall Timestamp JuliaVersion JuliaHash CodeHash OS
[1,] "ej" "mil" 318 0.000624418 1.96358e-6 1.09673e-5 9.53674e-7 "2013-01-06 02:46:58" "0.0.0+106299916.rdf56" "df564000a7" NA "Linux"
[2,] "ej" "cien" 282 7.65324e-5 2.71391e-7 1.19209e-6 0.0 "2013-01-06 02:46:58" "0.0.0+106299916.rdf56" "df564000a7" NA "Linux"
```