-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This version takes an already existing db and times how long it takes to load.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
import time | ||
import argparse | ||
|
||
import semidbm | ||
|
||
|
||
def measure_laod_time(db_path): | ||
num_loads = 10 | ||
times = [] | ||
o = semidbm.open | ||
for i in range(num_loads): | ||
start = time.time() | ||
db = o(db_path, 'c') | ||
times.append(time.time() - start) | ||
db.close() | ||
print "%.5f milliseconds average load time" % ( | ||
(sum(times) / float(num_loads)) * 1000) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('db_path') | ||
args = parser.parse_args() | ||
measure_laod_time(args.db_path) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |