Skip to content

Commit

Permalink
BENCH: add a no-op baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
ev-br committed Mar 28, 2016
1 parent 07b2d18 commit da67d2a
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions benchmarks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,66 @@
"%memit dok_poisson2d(100)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# `no-op` in the inner loop"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def noop(n):\n",
" n2 = n*n\n",
" for i in xrange(n):\n",
" for j in xrange(n):\n",
" k = i + n*j"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1000 loops, best of 3: 511 µs per loop\n"
]
}
],
"source": [
"%timeit noop(100)"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"peak memory: 39.73 MiB, increment: 0.00 MiB\n"
]
}
],
"source": [
"%memit noop(100)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit da67d2a

Please sign in to comment.