In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
import pandas as pd

In [3]:
import matplotlib
matplotlib.style.use('ggplot')

In [4]:
from StringIO import StringIO

In [5]:
!julia -e 'versioninfo()'


Julia Version 0.4.0
Commit 0ff703b* (2015-10-08 06:20 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i5-4288U CPU @ 2.60GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

In [6]:
!git show -s HEAD


commit 6ea7236d2467594059276f8a4ebbe553d7a61ca8
Author: Kenta Sato <bicycle1885@gmail.com>
Date:   Fri Oct 9 09:05:23 2015 +0900

    add pop!

In [7]:
!git status


On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   benchmark.ipynb

no changes added to commit (use "git add" and/or "git commit -a")

In [8]:
bench = !julia benchmark.jl
bench = "\n".join(bench)
bench = pd.read_table(StringIO(bench))

In [9]:
bench


Out[9]:
size construction minimum maximum push! pop! popmin! popmax!
0 100 0.000005 6.130000e-09 6.120000e-09 8.150000e-08 4.160000e-08 1.954000e-07 1.885000e-07
1 183 0.000007 5.120000e-09 5.130000e-09 6.800000e-08 3.540000e-08 1.773000e-07 1.707000e-07
2 335 0.000012 5.150000e-09 5.140000e-09 1.060000e-07 3.660000e-08 2.115000e-07 1.992000e-07
3 615 0.000023 5.190000e-09 5.170000e-09 3.730000e-07 3.570000e-08 2.206000e-07 2.217000e-07
4 1128 0.000039 5.110000e-09 5.170000e-09 5.375000e-07 3.650000e-08 2.410000e-07 2.415000e-07
5 2069 0.000076 5.200000e-09 5.220000e-09 8.367000e-07 3.650000e-08 2.493000e-07 2.589000e-07
6 3792 0.000139 5.140000e-09 5.220000e-09 3.662000e-07 3.540000e-08 2.833000e-07 2.854000e-07
7 6951 0.000239 5.190000e-09 5.210000e-09 4.491000e-07 4.480000e-08 3.221000e-07 3.007000e-07
8 12742 0.000428 5.170000e-09 5.140000e-09 7.674000e-07 3.710000e-08 3.095000e-07 3.177000e-07
9 23357 0.000852 5.160000e-09 5.220000e-09 1.239400e-06 4.010000e-08 3.405000e-07 3.563000e-07
10 42813 0.001490 5.220000e-09 5.140000e-09 2.656800e-06 5.390000e-08 3.821000e-07 3.880000e-07
11 78475 0.002944 5.220000e-09 5.170000e-09 4.606600e-06 4.570000e-08 3.922000e-07 4.383000e-07
12 143844 0.004923 5.240000e-09 5.190000e-09 9.076100e-06 5.280000e-08 4.618000e-07 4.712000e-07
13 263665 0.011028 5.790000e-09 5.770000e-09 8.124900e-06 7.890000e-08 5.350000e-07 5.511000e-07
14 483293 0.017495 6.690000e-09 5.230000e-09 1.104030e-05 9.090000e-08 5.992000e-07 6.655000e-07
15 885866 0.035352 6.020000e-09 6.350000e-09 2.276420e-05 9.540000e-08 7.815000e-07 7.767000e-07
16 1623776 0.064679 6.370000e-09 7.130000e-09 1.438830e-05 8.520000e-08 8.973000e-07 8.922000e-07
17 2976351 0.126674 6.510000e-09 6.770000e-09 2.877575e-04 8.960000e-08 9.633000e-07 9.294000e-07
18 5455594 0.250006 5.990000e-09 7.030000e-09 1.634151e-03 9.570000e-08 1.064200e-06 1.099800e-06
19 10000000 0.465622 6.410000e-09 6.320000e-09 4.803100e-05 9.420000e-08 1.127900e-06 1.264000e-06

In [10]:
figsize(12, 8)

In [11]:
bench.plot(x="size",
           title="Elapsed time per operation",
           logx=True, logy=True,
           linestyle="--", marker="o")
ylabel("elapsed time [s]")


Out[11]:
<matplotlib.text.Text at 0x10931d190>

In [12]:
bench.plot(x="size", y="construction", linestyle="--", marker="o")


Out[12]:
<matplotlib.axes._subplots.AxesSubplot at 0x1095d50d0>

In [13]:
bench.plot(x="size", y=["minimum", "maximum"], linestyle="--", marker="o")


Out[13]:
<matplotlib.axes._subplots.AxesSubplot at 0x10983ded0>

In [14]:
bench.plot(x="size", y="push!", linestyle="--", marker="o")


Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0x109fe5c90>

In [15]:
bench.plot(x="size", y="pop!", linestyle="--", marker="o")


Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x10a3e0cd0>

In [16]:
bench.plot(x="size", y=["popmin!", "popmax!"], linestyle="--", marker="o")


Out[16]:
<matplotlib.axes._subplots.AxesSubplot at 0x10a3cd990>