Skip to content

Instantly share code, notes, and snippets.

@nekoya
Created August 8, 2014 03:11
Show Gist options
  • Select an option

  • Save nekoya/b83240feacf28a4c791e to your computer and use it in GitHub Desktop.

Select an option

Save nekoya/b83240feacf28a4c791e to your computer and use it in GitHub Desktop.
from benchmarker import Benchmarker
items = [1, 'foo', 'bar', 0, 0, 0]
with Benchmarker(width=40, loop=1000000) as bm:
for _ in bm('map'):
map(str, items)
for _ in bm('list'):
[str(x) for x in items]
"""
## benchmarker: release 3.0.1 (for python)
## python platform: linux2 [GCC 4.6.3]
## python version: 2.7.3
## python executable: /kauli/common/python27/bin/python
## user sys total real
map 0.8500 0.0000 0.8500 0.8836
list 1.4200 0.0000 1.4200 1.4222
## Ranking real
map 0.8836 (100.0%) *************************
list 1.4222 ( 62.1%) ****************
## Ratio Matrix real [01] [02]
[01] map 0.8836 100.0% 161.0%
[02] list 1.4222 62.1% 100.0%
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment