Skip to content

Commit

Permalink
Flushing stdout after every result (for better use with tee)
Browse files Browse the repository at this point in the history
  • Loading branch information
pykler committed Jun 16, 2013
1 parent 1ed5c77 commit 097f5ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion concat-test/concat-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

def main():
test_runs = 1000000
test_range = 1000
w = csv.writer(sys.stdout)
styles = ['plus', 'join', 'format']
w.writerow([''] + styles)
for i in range(10):
for i in range(test_range):
sr = {}
for style in styles:
tr = timeit.timeit(
Expand All @@ -21,6 +22,7 @@ def main():
)
sr[style] = tr
w.writerow([str(i+1)] + ['%.3f' % (sr[s] * MICRO / test_runs) for s in styles])
sys.stdout.flush()

if __name__ == '__main__':
main()

0 comments on commit 097f5ce

Please sign in to comment.