Skip to content

Commit

Permalink
remove priming time from bench
Browse files Browse the repository at this point in the history
- avoid timing monitor gc from #1007
  • Loading branch information
casperdcl committed Jul 19, 2020
1 parent 49a372a commit 75f8e92
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions tqdm/tests/tests_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ def test_iter_overhead_hard():
total = int(1e5)

with closing(MockIO()) as our_file:
with trange(1, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0) as t:
with relative_timer() as prime:
for i in t:
pass

a = 0
with trange(total, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0) as t:
Expand All @@ -282,7 +288,8 @@ def test_iter_overhead_hard():
a += i
our_file.write(("%i" % a) * 40)

assert_performance(85, 'trange', time_tqdm(), 'range', time_bench())
assert_performance(
85, 'trange', time_tqdm() - prime(), 'range', time_bench())


@with_setup(pretest, posttest)
Expand All @@ -293,6 +300,12 @@ def test_manual_overhead_hard():
total = int(1e5)

with closing(MockIO()) as our_file:
with trange(1, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0) as t:
with relative_timer() as prime:
for i in t:
pass

t = tqdm(total=total * 10, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0)
a = 0
Expand All @@ -307,7 +320,8 @@ def test_manual_overhead_hard():
a += i
our_file.write(("%i" % a) * 40)

assert_performance(85, 'tqdm', time_tqdm(), 'range', time_bench())
assert_performance(
85, 'tqdm', time_tqdm() - prime(), 'range', time_bench())


@with_setup(pretest, posttest)
Expand All @@ -318,6 +332,12 @@ def test_iter_overhead_simplebar_hard():
total = int(1e4)

with closing(MockIO()) as our_file:
with trange(1, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0) as t:
with relative_timer() as prime:
for i in t:
pass

a = 0
with trange(total, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0) as t:
Expand All @@ -334,7 +354,7 @@ def test_iter_overhead_simplebar_hard():
a += i

assert_performance(
5, 'trange', time_tqdm(), 'simple_progress', time_bench())
5, 'trange', time_tqdm() - prime(), 'simple_progress', time_bench())


@with_setup(pretest, posttest)
Expand All @@ -345,6 +365,12 @@ def test_manual_overhead_simplebar_hard():
total = int(1e4)

with closing(MockIO()) as our_file:
with trange(1, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0) as t:
with relative_timer() as prime:
for i in t:
pass

t = tqdm(total=total * 10, file=our_file, leave=True, miniters=1,
mininterval=0, maxinterval=0)
a = 0
Expand All @@ -363,4 +389,4 @@ def test_manual_overhead_simplebar_hard():
simplebar_update(10)

assert_performance(
5, 'tqdm', time_tqdm(), 'simple_progress', time_bench())
5, 'tqdm', time_tqdm() - prime(), 'simple_progress', time_bench())

0 comments on commit 75f8e92

Please sign in to comment.