Skip to content

Instantly share code, notes, and snippets.

@153957
Created February 14, 2013 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 153957/4952812 to your computer and use it in GitHub Desktop.
Save 153957/4952812 to your computer and use it in GitHub Desktop.
In the early version of Gist 4731132 I tested the speed of some retrieving some information from a h5 file. I thought a difference was found when certain steps where skipped. When testing my code in that gist today I found that the various methods gave the same results. Apparently the part that caused the speed difference was the one thing that …
import timeit
r_relative = timeit.Timer(stmt="read = tables.openFile('[path relative to cwd].h5', 'r'); read.close()", setup='import tables')
min(r_relative(2000, 100))
# 0.04840588569641113
r_absolute = timeit.Timer(stmt="read = tables.openFile('[path starting with /].h5', 'r'); read.close()", setup='import tables')
min(r_absolute.repeat(2000, 100))
# 0.00023484230041503906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment