In [25]:
Pkg.add("DataFrames")
Pkg.add("Gadfly")


INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of DataFrames
INFO: Use `Pkg.update()` to get the latest versions of your packages
INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of Gadfly
INFO: Use `Pkg.update()` to get the latest versions of your packages

In [2]:
cd("/Users/utensil/experiments")

In [4]:
run(`git clone https://github.com/JuliaLang/julia.git`)


Cloning into 'julia'...

In [3]:
cd("julia/test/perf/micro")

In [4]:
run(pipeline(`python perf.py`, stdout="py.csv"))

In [5]:
run(pipeline(`julia perf.jl`, stdout="jl.csv"))

In [6]:
run(pipeline(`r --vanilla --slave -f perf.R`, stdout="r.csv"))


载入需要的程辑包:compiler

In [7]:
run(pipeline(`cat py.csv r.csv`, stdout="benchmarks.csv"))

In [8]:
using DataFrames
using Gadfly

In [10]:
jl_data = readtable("jl.csv", header=false, names=[:language, :benchmark, :min, :max, :mean_time, :std])


Out[10]:
languagebenchmarkminmaxmean_timestd
1juliafib0.05661512.9298250.067210.095576
2juliaparse_int0.18427614.1525070.2403930.233401
3juliamandel0.20714615.4220470.2543430.232392
4juliaquicksort0.372664.6465820.4427880.085605
5juliapi_sum23.33720240.23736126.384792.331499
6juliarand_mat_stat20.95493558.054224.9824745.086046
7juliarand_mat_mul36.42105149.18916139.8830873.066839
8juliaprintfd25.06124234.10415927.5902731.608627

In [18]:
benchmarks = readtable("benchmarks.csv", header=false, names=[:language, :benchmark, :mean_time])


Out[18]:
languagebenchmarkmean_time
1pythonfib2.87795066833
2pythonparse_int2.0809173584
3pythonmandel3.95393371582
4pythonquicksort14.358997345
5pythonpi_sum652.050018311
6pythonrand_mat_stat125.365018845
7pythonrand_mat_mul66.064119339
8rfib16.0
9rparse_int4.0
10rquicksort93.0
11rmandel12.0
12rpi_sum332.0
13rrand_mat_stat86.0
14rrand_mat_mul137.0

In [19]:
jl_benchmarks = jl_data[:, [:language, :benchmark, :mean_time]]


Out[19]:
languagebenchmarkmean_time
1juliafib0.06721
2juliaparse_int0.240393
3juliamandel0.254343
4juliaquicksort0.442788
5juliapi_sum26.38479
6juliarand_mat_stat24.982474
7juliarand_mat_mul39.883087
8juliaprintfd27.590273

In [20]:
benchmarks = [benchmarks; jl_benchmarks]


Out[20]:
languagebenchmarkmean_time
1pythonfib2.87795066833
2pythonparse_int2.0809173584
3pythonmandel3.95393371582
4pythonquicksort14.358997345
5pythonpi_sum652.050018311
6pythonrand_mat_stat125.365018845
7pythonrand_mat_mul66.064119339
8rfib16.0
9rparse_int4.0
10rquicksort93.0
11rmandel12.0
12rpi_sum332.0
13rrand_mat_stat86.0
14rrand_mat_mul137.0
15juliafib0.06721
16juliaparse_int0.240393
17juliamandel0.254343
18juliaquicksort0.442788
19juliapi_sum26.38479
20juliarand_mat_stat24.982474
21juliarand_mat_mul39.883087
22juliaprintfd27.590273

In [21]:
p = plot(benchmarks,
    x = :language,
    y = :mean_time,
    color = :benchmark,
    Scale.y_log10,
    Guide.ylabel(nothing),
    Guide.xlabel(nothing),
    Theme(
        default_point_size = 1mm,
        guide_title_position = :left,
        colorkey_swatch_shape = :circle,
        minor_label_font = "Georgia",
        major_label_font = "Georgia",
    ),
)
draw(SVG(8inch,8inch/golden), p)


python r julia fib parse_int mandel quicksort pi_sum rand_mat_stat rand_mat_mul printfd benchmark 10-2 10-1 100 101 102 103

In [23]:
p = plot(benchmarks,
    x = :language,
    y = :mean_time,
    color = :benchmark,
    Scale.y_continuous,
    Guide.ylabel(nothing),
    Guide.xlabel(nothing),
    Theme(
        default_point_size = 1mm,
        guide_title_position = :left,
        colorkey_swatch_shape = :circle,
        minor_label_font = "Georgia",
        major_label_font = "Georgia",
    ),
)
draw(SVG(8inch,8inch/golden), p)


python r julia fib parse_int mandel quicksort pi_sum rand_mat_stat rand_mat_mul printfd benchmark 0 200 400 600 800

In [ ]: