medols/fresh

View on GitHub
doc/raspi3_speed_up.ipynb

Summary

Maintainability
Test Coverage
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warming up --------------------------------------\n",
      "              mpi no     1.000  i/100ms\n",
      "              mpi x1     1.000  i/100ms\n",
      "              mpi x2     1.000  i/100ms\n",
      "              mpi x3     1.000  i/100ms\n",
      "              mpi x4     1.000  i/100ms\n",
      "              mpi x5     1.000  i/100ms\n",
      "              mpi x6     1.000  i/100ms\n",
      "              mpi x7     1.000  i/100ms\n",
      "              mpi x8     1.000  i/100ms\n",
      "Calculating -------------------------------------\n",
      "              mpi no      0.256  (± 0.0%) i/s -      2.000  in   7.802058s\n",
      "              mpi x1      0.264  (± 0.0%) i/s -      2.000  in   7.571911s\n",
      "              mpi x2      0.458  (± 0.0%) i/s -      3.000  in   6.574939s\n",
      "              mpi x3      0.664  (± 0.0%) i/s -      4.000  in   6.048550s\n",
      "              mpi x4      0.895  (± 0.0%) i/s -      5.000  in   5.992848s\n",
      "              mpi x5      0.789  (± 0.0%) i/s -      5.000  in   6.352104s\n",
      "              mpi x6      0.792  (± 0.0%) i/s -      4.000 \n",
      "              mpi x7      0.773  (± 0.0%) i/s -      4.000 \n",
      "              mpi x8      0.817  (± 0.0%) i/s -      5.000  in   6.128984s\n",
      "\n",
      "Comparison:\n",
      "              mpi x4:        0.9 i/s\n",
      "              mpi x8:        0.8 i/s - 1.10x  slower\n",
      "              mpi x6:        0.8 i/s - 1.13x  slower\n",
      "              mpi x5:        0.8 i/s - 1.13x  slower\n",
      "              mpi x7:        0.8 i/s - 1.16x  slower\n",
      "              mpi x3:        0.7 i/s - 1.35x  slower\n",
      "              mpi x2:        0.5 i/s - 1.96x  slower\n",
      "              mpi x1:        0.3 i/s - 3.39x  slower\n",
      "              mpi no:        0.3 i/s - 3.49x  slower\n",
      "\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"  standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg \n",
       " width=\"600\" height=\"480\"\n",
       " viewBox=\"0 0 600 480\"\n",
       " xmlns=\"http://www.w3.org/2000/svg\"\n",
       " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
       ">\n",
       "\n",
       "<title>Gnuplot</title>\n",
       "<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
       "\n",
       "<g id=\"gnuplot_canvas\">\n",
       "\n",
       "<rect x=\"0\" y=\"0\" width=\"600\" height=\"480\" fill=\"none\"/>\n",
       "<defs>\n",
       "\n",
       "\t<circle id='gpDot' r='0.5' stroke-width='0.5'/>\n",
       "\t<path id='gpPt0' stroke-width='0.222' stroke='currentColor' d='M-1,0 h2 M0,-1 v2'/>\n",
       "\t<path id='gpPt1' stroke-width='0.222' stroke='currentColor' d='M-1,-1 L1,1 M1,-1 L-1,1'/>\n",
       "\t<path id='gpPt2' stroke-width='0.222' stroke='currentColor' d='M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1'/>\n",
       "\t<rect id='gpPt3' stroke-width='0.222' stroke='currentColor' x='-1' y='-1' width='2' height='2'/>\n",
       "\t<rect id='gpPt4' stroke-width='0.222' stroke='currentColor' fill='currentColor' x='-1' y='-1' width='2' height='2'/>\n",
       "\t<circle id='gpPt5' stroke-width='0.222' stroke='currentColor' cx='0' cy='0' r='1'/>\n",
       "\t<use xlink:href='#gpPt5' id='gpPt6' fill='currentColor' stroke='none'/>\n",
       "\t<path id='gpPt7' stroke-width='0.222' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/>\n",
       "\t<use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/>\n",
       "\t<use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/>\n",
       "\t<use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/>\n",
       "\t<use xlink:href='#gpPt3' id='gpPt11' stroke='currentColor' transform='rotate(45)'/>\n",
       "\t<use xlink:href='#gpPt11' id='gpPt12' fill='currentColor' stroke='none'/>\n",
       "\t<path id='gpPt13' stroke-width='0.222' stroke='currentColor' d='M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z'/>\n",
       "\t<use xlink:href='#gpPt13' id='gpPt14' fill='currentColor' stroke='none'/>\n",
       "\t<filter id='textbox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'>\n",
       "\t  <feFlood flood-color='white' flood-opacity='1' result='bgnd'/>\n",
       "\t  <feComposite in='SourceGraphic' in2='bgnd' operator='atop'/>\n",
       "\t</filter>\n",
       "\t<filter id='greybox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'>\n",
       "\t  <feFlood flood-color='lightgrey' flood-opacity='1' result='grey'/>\n",
       "\t  <feComposite in='SourceGraphic' in2='grey' operator='atop'/>\n",
       "\t</filter>\n",
       "</defs>\n",
       "<g fill=\"none\" color=\"white\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,444.0 L62.9,444.0 M575.0,444.0 L566.0,444.0  '/>\t<g transform=\"translate(45.6,448.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,390.6 L62.9,390.6 M575.0,390.6 L566.0,390.6  '/>\t<g transform=\"translate(45.6,395.1)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.5</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,337.2 L62.9,337.2 M575.0,337.2 L566.0,337.2  '/>\t<g transform=\"translate(45.6,341.7)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 1</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,283.8 L62.9,283.8 M575.0,283.8 L566.0,283.8  '/>\t<g transform=\"translate(45.6,288.3)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 1.5</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,230.3 L62.9,230.3 M575.0,230.3 L566.0,230.3  '/>\t<g transform=\"translate(45.6,234.8)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 2</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,176.9 L62.9,176.9 M575.0,176.9 L566.0,176.9  '/>\t<g transform=\"translate(45.6,181.4)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 2.5</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,123.5 L62.9,123.5 M575.0,123.5 L566.0,123.5  '/>\t<g transform=\"translate(45.6,128.0)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 3</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,70.1 L62.9,70.1 M575.0,70.1 L566.0,70.1  '/>\t<g transform=\"translate(45.6,74.6)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 3.5</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,16.7 L62.9,16.7 M575.0,16.7 L566.0,16.7  '/>\t<g transform=\"translate(45.6,21.2)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 4</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,444.0 L53.9,435.0 M53.9,16.7 L53.9,25.7  '/>\t<g transform=\"translate(53.9,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M119.0,444.0 L119.0,435.0 M119.0,16.7 L119.0,25.7  '/>\t<g transform=\"translate(119.0,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 1</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M184.2,444.0 L184.2,435.0 M184.2,16.7 L184.2,25.7  '/>\t<g transform=\"translate(184.2,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 2</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M249.3,444.0 L249.3,435.0 M249.3,16.7 L249.3,25.7  '/>\t<g transform=\"translate(249.3,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 3</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M314.5,444.0 L314.5,435.0 M314.5,16.7 L314.5,25.7  '/>\t<g transform=\"translate(314.5,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 4</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M379.6,444.0 L379.6,435.0 M379.6,16.7 L379.6,25.7  '/>\t<g transform=\"translate(379.6,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 5</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M444.7,444.0 L444.7,435.0 M444.7,16.7 L444.7,25.7  '/>\t<g transform=\"translate(444.7,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 6</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M509.9,444.0 L509.9,435.0 M509.9,16.7 L509.9,25.7  '/>\t<g transform=\"translate(509.9,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 7</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M575.0,444.0 L575.0,435.0 M575.0,16.7 L575.0,25.7  '/>\t<g transform=\"translate(575.0,466.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 8</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,16.7 L53.9,444.0 L575.0,444.0 L575.0,16.7 L53.9,16.7 Z  '/></g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "\t<g id=\"gnuplot_plot_1\" ><title>speedup</title>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<g transform=\"translate(507.9,39.2)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" >speedup</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='rgb(148,   0, 211)'  d='M516.2,34.7 L558.4,34.7 M53.9,337.2 L119.0,333.9 L184.2,253.2 L249.3,167.3 L314.5,70.9 L379.6,115.1\n",
       "\t\tL444.7,114.1 L509.9,122.1 L575.0,103.6  '/>\t<use xlink:href='#gpPt0' transform='translate(53.9,337.2) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(119.0,333.9) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(184.2,253.2) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(249.3,167.3) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(314.5,70.9) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(379.6,115.1) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(444.7,114.1) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(509.9,122.1) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(575.0,103.6) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "\t<use xlink:href='#gpPt0' transform='translate(537.3,34.7) scale(4.50)' color='rgb(148,   0, 211)'/>\n",
       "</g>\n",
       "\t</g>\n",
       "<g fill=\"none\" color=\"white\" stroke=\"rgb(148,   0, 211)\" stroke-width=\"2.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"2.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,16.7 L53.9,444.0 L575.0,444.0 L575.0,16.7 L53.9,16.7 Z  '/></g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ],
      "text/plain": [
       "#<Gnuplot::Plot:0x3c20 @arbitrary_lines=[] @cmd=\"plot\" @data=[#<Gnuplot::DataSet:0x3c28 @using=nil @with=\"linespoints\" @title=\"speedup\" @axes=nil @smooth=nil @matrix=nil @linecolor=nil @data=[[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0], [1.0, 1.0303888910337053, 1.7863595363620268, 2.590348473057943, 3.4924843709929085, 3.078752946171534, 3.08813685514885, 3.0136783153423043, 3.1868077621561492]] @linewidth=nil>] @settings=[[:set, \"yrange\", \"[0:4]\"], [:set, \"terminal\", \"svg enhanced\"], [:set, \"output\", \"\\\"/tmp/plot20161027-22412-7liqy9\\\"\"]]>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "require 'gnuplot'\n",
    "require 'fresh-mc'\n",
    "require 'benchmark/ips'\n",
    "\n",
    "L=1_000_000\n",
    "\n",
    "def mpi n\n",
    "  (proc{ s=L/size; ((s*rank+1)..(s*rank+s)).sum }*n).sum\n",
    "  nil\n",
    "end\n",
    "\n",
    "def mpi_less\n",
    "  (1..L).sum\n",
    "  nil\n",
    "end\n",
    "\n",
    "bm=Benchmark.ips do |x|\n",
    "  x.report(\"mpi no\") { mpi_less }\n",
    "  (1..8).each{|i| x.report(\"mpi x#{i}\") { mpi i } }\n",
    "  x.compare!\n",
    "end\n",
    "\n",
    "cpu   = (0..8).collect { |v| v.to_f }\n",
    "ref   = bm.entries.first.stats.central_tendency\n",
    "speed = bm.entries.map{|e| e.stats.central_tendency/ref }\n",
    "\n",
    "Gnuplot::Plot.new do |gp| \n",
    "  gp.yrange \"[0:4]\"\n",
    "  gp.data << Gnuplot::DataSet.new([cpu, speed]) do |ds| \n",
    "    ds.with = \"linespoints\"\n",
    "    ds.title = \"speedup\"\n",
    "  end\n",
    "end"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Ruby 2.3.1",
   "language": "ruby",
   "name": "ruby"
  },
  "language_info": {
   "file_extension": ".rb",
   "mimetype": "application/x-ruby",
   "name": "ruby",
   "version": "2.3.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}