Skip to content

Instantly share code, notes, and snippets.

@tshort
Created July 25, 2012 14:18
Show Gist options
  • Save tshort/3176422 to your computer and use it in GitHub Desktop.
Save tshort/3176422 to your computer and use it in GitHub Desktop.
Julia benchmarks and bounds checking

Here are results of Julia's benchmarks with and without bounds checking:

DataFrame  (16,3)
                         type       benchmark     time
[1,]     "no bounds checking"           "fib" 0.210762
[2,]               "standard"           "fib" 0.211954
[3,]     "no bounds checking"        "mandel" 0.572634
[4,]               "standard"        "mandel" 0.587797
[5,]     "no bounds checking"     "parse_int" 0.207615
[6,]               "standard"     "parse_int"  0.20833
[7,]     "no bounds checking"        "pi_sum"  30.6358
[8,]               "standard"        "pi_sum"  30.6367
[9,]     "no bounds checking"       "printfd"  17.0588
[10,]              "standard"       "printfd"  17.2364
[11,]    "no bounds checking"     "quicksort" 0.406361
[12,]              "standard"     "quicksort" 0.437069
[13,]    "no bounds checking"  "rand_mat_mul"   46.666
[14,]              "standard"  "rand_mat_mul"    47.16
[15,]    "no bounds checking" "rand_mat_stat"  13.3354
[16,]              "standard" "rand_mat_stat"  13.3482

Also, I used Harlan's JuliaData package for this quick analysis. Here's the code:

function analyze_benchmarks()
    dstd = csvDataFrame("julia/test/perf/benchmarks/julia_standard.csv",
                        @options colnames = "false")
    dstd["type"] = "standard"
    dnobounds = csvDataFrame("julia/test/perf/benchmarks/julia_no_bounds_checking.csv",
                             @options colnames = "false")
    dnobounds["type"] = "no bounds checking"
    d = rbind(dstd, dnobounds)
    colnames!(d, ["language", "benchmark", "time", "type"])
    groupby(d, ["type", "benchmark"]) | :( time = mean(nafilter(time)) )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment