[Python-checkins] r46097 - sandbox/trunk/stringbench/stringbench.py
andrew.dalke
python-checkins at python.org
Tue May 23 12:48:47 CEST 2006
Author: andrew.dalke
Date: Tue May 23 12:48:46 2006
New Revision: 46097
Modified:
sandbox/trunk/stringbench/stringbench.py
Log:
Added new tests.
Modified: sandbox/trunk/stringbench/stringbench.py
==============================================================================
--- sandbox/trunk/stringbench/stringbench.py (original)
+++ sandbox/trunk/stringbench/stringbench.py Tue May 23 12:48:46 2006
@@ -1,4 +1,6 @@
+# Various microbenchmarks comparing unicode and byte string performance
+
import timeit
import itertools
import operator
@@ -18,25 +20,25 @@
_RANGE_1000 = range(1000)
_RANGE_100 = range(100)
-def bench(s="", group=1):
+def bench(s, group, repeat_count):
def blah(f):
f.comment = s
f.is_bench = True
f.group = group
+ f.repeat_count = repeat_count
return f
return blah
####### 'in' comparisons
-
- at bench('"A" in "A"*1000', group="early match, single character")
+ at bench('"A" in "A"*1000', "early match, single character", 1000)
def in_test_quick_match_single_character(STR):
s1 = STR("A" * 1000)
s2 = STR("A")
for x in _RANGE_1000:
s2 in s1
- at bench('"B" in "A"*1000', group="no match, single character")
+ at bench('"B" in "A"*1000', "no match, single character", 1000)
def in_test_no_match_single_character(STR):
s1 = STR("A" * 1000)
s2 = STR("B")
@@ -44,21 +46,21 @@
s2 in s1
- at bench('"AB" in "AB"*1000', group="early match, two characters")
+ at bench('"AB" in "AB"*1000', "early match, two characters", 1000)
def in_test_quick_match_two_characters(STR):
s1 = STR("AB" * 1000)
s2 = STR("AB")
for x in _RANGE_1000:
s2 in s1
- at bench('"BC" in "AB"*1000', group="no match, two characters")
+ at bench('"BC" in "AB"*1000', "no match, two characters", 1000)
def in_test_no_match_two_character(STR):
s1 = STR("AB" * 1000)
s2 = STR("BC")
for x in _RANGE_1000:
s2 in s1
- at bench('"BC" in ("AB"*1000+"C")', group="late match, two characters")
+ at bench('"BC" in ("AB"*1000+"C")', "late match, two characters", 1000)
def in_test_slow_match_two_characters(STR):
s1 = STR("AB" * 1000+"C")
s2 = STR("BC")
@@ -66,7 +68,7 @@
s2 in s1
@bench('s="ABC"*33; s in ((s+"D")*500+s+"E")',
- group="late match, 100 characters")
+ "late match, 100 characters", 100)
def in_test_slow_match_100_characters(STR):
m = STR("ABC"*33)
s1 = (m+"D")*500 + m+"E"
@@ -76,7 +78,7 @@
# Try with regex
@bench('s="ABC"*33; re.compile(s+"D").search((s+"D")*500+s+"E")',
- group="late match, 100 characters")
+ "late match, 100 characters", 100)
def re_test_slow_match_100_characters(STR):
m = STR("ABC"*33)
s1 = (m+"D")*500 + m+"E"
@@ -85,11 +87,15 @@
search = pat.search
for x in _RANGE_100:
search(s1)
-
+
#### same tests as 'in' but use 'find'
- at bench('("A"*1000).find("A")', group="early match, single character")
+# Add rfind
+
+
+
+ at bench('("A"*1000).find("A")', "early match, single character", 1000)
def find_quick_match_single_character(STR):
s1 = STR("A" * 1000)
s2 = STR("A")
@@ -97,7 +103,7 @@
for x in _RANGE_1000:
s1_find(s2)
- at bench('("A"*1000).find("B")', group="no match, single character")
+ at bench('("A"*1000).find("B")', "no match, single character", 1000)
def find_test_no_match_single_character(STR):
s1 = STR("A" * 1000)
s2 = STR("B")
@@ -106,7 +112,7 @@
s1_find(s2)
- at bench('("AB"*1000).find("AB")', group="early match, two characters")
+ at bench('("AB"*1000).find("AB")', "early match, two characters", 1000)
def find_test_quick_match_two_characters(STR):
s1 = STR("AB" * 1000)
s2 = STR("AB")
@@ -114,7 +120,7 @@
for x in _RANGE_1000:
s1_find(s2)
- at bench('("AB"*1000).find("BC")', group="no match, two characters")
+ at bench('("AB"*1000).find("BC")', "no match, two characters", 1000)
def find_test_no_match_two_character(STR):
s1 = STR("AB" * 1000)
s2 = STR("BC")
@@ -122,7 +128,7 @@
for x in _RANGE_1000:
s1_find(s2)
- at bench('("AB"*1000+"C").find("BC")', group="late match, two characters")
+ at bench('"BC" in ("AB"*1000+"C")', "late match, two characters", 1000)
def find_test_slow_match_two_characters(STR):
s1 = STR("AB" * 1000+"C")
s2 = STR("BC")
@@ -131,7 +137,7 @@
s1_find(s2)
@bench('s="ABC"*33; ((s+"D")*500+s+"E").find(s)',
- group="late match, 100 characters")
+ "late match, 100 characters", 100)
def find_test_slow_match_100_characters(STR):
m = STR("ABC"*33)
s1 = (m+"D")*500 + m+"E"
@@ -141,10 +147,11 @@
s1_find(s2)
#### Now with index.
-# Skip the ones which fail because the
+# Skip the ones which fail because that would include exception overhead.
+# Add rindex tests.
-
- at bench('("A"*1000).index("A")', group="early match, single character")
+
+ at bench('("A"*1000).index("A")', "early match, single character", 1000)
def index_test_quick_match_single_character(STR):
s1 = STR("A" * 1000)
s2 = STR("A")
@@ -153,7 +160,7 @@
s1_index(s2)
- at bench('("AB"*1000).index("AB")', group="early match, two characters")
+ at bench('("AB"*1000).index("AB")', "early match, two characters", 1000)
def index_test_quick_match_two_characters(STR):
s1 = STR("AB" * 1000)
s2 = STR("AB")
@@ -161,7 +168,7 @@
for x in _RANGE_1000:
s1_index(s2)
- at bench('("AB"*1000+"C").index("BC")', group="late match, two characters")
+ at bench('("AB"*1000+"C").index("BC")', "late match, two characters", 1000)
def index_test_slow_match_two_characters(STR):
s1 = STR("AB" * 1000+"C")
s2 = STR("BC")
@@ -170,7 +177,7 @@
s1_index(s2)
@bench('s="ABC"*33; ((s+"D")*500+s+"E").index(s)',
- group="late match, 100 characters")
+ "late match, 100 characters", 100)
def index_test_slow_match_100_characters(STR):
m = STR("ABC"*33)
s1 = (m+"D")*500 + m+"E"
@@ -181,40 +188,41 @@
#### Benchmark the operator-based methods
- at bench('"A"*10', "repeat 1 character 10 times")
+ at bench('"A"*10', "repeat 1 character 10 times", 1000)
def repeat_single_10_times(STR):
s = STR("A")
for x in _RANGE_1000:
s * 10
- at bench('"A"*1000', "repeat 1 character 1000 times")
+ at bench('"A"*1000', "repeat 1 character 1000 times", 1000)
def repeat_single_1000_times(STR):
s = STR("A")
for x in _RANGE_1000:
s * 1000
- at bench('"ABCDE"*10', "repeat 5 characters 10 times")
+ at bench('"ABCDE"*10', "repeat 5 characters 10 times", 1000)
def repeat_5_10_times(STR):
s = STR("ABCDE")
for x in _RANGE_1000:
s * 10
- at bench('"ABCDE"*1000', "repeat 5 characters 1000 times")
+ at bench('"ABCDE"*1000', "repeat 5 characters 1000 times", 1000)
def repeat_5_1000_times(STR):
s = STR("ABCDE")
for x in _RANGE_1000:
s * 1000
-
+
# + for concat
- at bench('"Andrew"+"Dalke"', "concat two strings")
+ at bench('"Andrew"+"Dalke"', "concat two strings", 1000)
def concat_two_strings(STR):
s1 = STR("Andrew")
s2 = STR("Dalke")
for x in _RANGE_1000:
s1+s2
- at bench('s1+s2+s3+s4+...+s20', "concat 20 strings of words length 4 to 15")
+ at bench('s1+s2+s3+s4+...+s20', "concat 20 strings of words length 4 to 15",
+ 1000)
def concat_two_strings(STR):
s1=STR('TIXSGYNREDCVBHJ')
s2=STR('PUMTLXBZVDO')
@@ -244,7 +252,7 @@
#### Benchmark join
@bench('"A".join("")',
- "join empty string, with 1 character sep")
+ "join empty string, with 1 character sep", 1000)
def join_empty_single(STR):
sep = STR("A")
s2 = STR("")
@@ -253,7 +261,7 @@
sep_join(s2)
@bench('"ABCDE".join("")',
- "join empty string, with 5 character sep")
+ "join empty string, with 5 character sep", 1000)
def join_empty_5(STR):
sep = STR("ABCDE")
s2 = STR("")
@@ -262,7 +270,7 @@
sep_join(s2)
@bench('"A".join("ABC..Z")',
- "join string with 26 characters, with 1 character sep")
+ "join string with 26 characters, with 1 character sep", 1000)
def join_alphabet_single(STR):
sep = STR("A")
s2 = STR("ABCDEFGHIJKLMnOPQRSTUVWXYZ")
@@ -271,7 +279,7 @@
sep_join(s2)
@bench('"ABCDE".join("ABC..Z")',
- "join string with 26 characters, with 5 character sep")
+ "join string with 26 characters, with 5 character sep", 1000)
def join_alphabet_5(STR):
sep = STR("ABCDE")
s2 = STR("ABCDEFGHIJKLMnOPQRSTUVWXYZ")
@@ -280,7 +288,7 @@
sep_join(s2)
@bench('"A".join(list("ABC..Z"))',
- "join list of 26 characters, with 1 character sep")
+ "join list of 26 characters, with 1 character sep", 1000)
def join_alphabet_list_single(STR):
sep = STR("A")
s2 = list(STR("ABCDEFGHIJKLMnOPQRSTUVWXYZ"))
@@ -289,7 +297,7 @@
sep_join(s2)
@bench('"ABCDE".join(list("ABC..Z"))',
- "join list of 26 characters, with 5 character sep")
+ "join list of 26 characters, with 5 character sep", 1000)
def join_alphabet_list_five(STR):
sep = STR("ABCDE")
s2 = list(STR("ABCDEFGHIJKLMnOPQRSTUVWXYZ"))
@@ -298,7 +306,7 @@
sep_join(s2)
@bench('"A".join(["Bob"]*1000))',
- "join list of 1000 words, with 1 character sep")
+ "join list of 1000 words, with 1 character sep", 1000)
def join_1000_words_single(STR):
sep = STR("A")
s2 = [STR("Bob")]*1000
@@ -307,7 +315,7 @@
sep_join(s2)
@bench('"ABCDE".join(["Bob"]*1000))',
- "join list of 1000 words, with 5 character sep")
+ "join list of 1000 words, with 5 character sep", 1000)
def join_1000_words_5(STR):
sep = STR("ABCDE")
s2 = [STR("Bob")]*1000
@@ -317,21 +325,21 @@
#### split tests
- at bench('"this\\nis\\na\\ntest\\n".split("\\n")', "split newlines")
+ at bench('"this\\nis\\na\\ntest\\n".split("\\n")', "split newlines", 1000)
def newlines_split(STR):
s = STR("this\nis\na\ntest\n")
s_split = s.split
for x in _RANGE_1000:
s_split("\n")
-
- at bench('"this\\nis\\na\\ntest\\n".rsplit("\\n")', "split newlines")
+
+ at bench('"this\\nis\\na\\ntest\\n".rsplit("\\n")', "split newlines", 1000)
def newlines_rsplit(STR):
s = STR("this\nis\na\ntest\n")
s_rsplit = s.rsplit
for x in _RANGE_1000:
s_rsplit("\n")
-
- at bench('"this\\nis\\na\\ntest\\n".splitlines()', "split newlines")
+
+ at bench('"this\\nis\\na\\ntest\\n".splitlines()', "split newlines", 1000)
def newlines_splitlines(STR):
s = STR("this\nis\na\ntest\n")
s_splitlines = s.splitlines
@@ -339,7 +347,7 @@
s_splitlines()
## split text with 2000 newlines
-
+
def _make_2000_lines():
import random
r = random.Random(100)
@@ -360,23 +368,23 @@
if STR is str:
return _text_with_2000_lines
raise AssertionError
+
-
- at bench('"...text...".split("\\n")', "split 2000 newlines")
+ at bench('"...text...".split("\\n")', "split 2000 newlines", 100)
def newlines_split_2000(STR):
s = _get_2000_lines(STR)
s_split = s.split
for x in _RANGE_100:
s_split("\n")
-
- at bench('"...text...".rsplit("\\n")', "split 2000 newlines")
+
+ at bench('"...text...".rsplit("\\n")', "split 2000 newlines", 100)
def newlines_rsplit_2000(STR):
s = _get_2000_lines(STR)
s_rsplit = s.rsplit
for x in _RANGE_100:
s_rsplit("\n")
-
- at bench('"...text...".splitlines()', "split 2000 newlines")
+
+ at bench('"...text...".splitlines()', "split 2000 newlines", 100)
def newlines_splitlines_2000(STR):
s = _get_2000_lines(STR)
s_splitlines = s.splitlines
@@ -387,7 +395,7 @@
## split text on "--" characters
@bench(
'"this--is--a--test--of--the--emergency--broadcast--system".split("--")',
- "split on multicharacter seperator")
+ "split on multicharacter seperator", 1000)
def split_multichar_sep(STR):
s = STR("this--is--a--test--of--the--emergency--broadcast--system")
s_split = s.split
@@ -395,7 +403,7 @@
s_split("--")
@bench(
'"this--is--a--test--of--the--emergency--broadcast--system".rsplit("--")',
- "split on multicharacter seperator")
+ "split on multicharacter seperator", 1000)
def rsplit_multichar_sep(STR):
s = STR("this--is--a--test--of--the--emergency--broadcast--system")
s_rsplit = s.rsplit
@@ -408,28 +416,28 @@
"I", "Genomic_canonical", "region", "357208", "396183", ".", "+", ".",
"ID=Sequence:R119;note=Clone R119%3B Genbank AF063007;Name=R119"])
- at bench('GFF3_example.split("\\t")', "tab split")
+ at bench('GFF3_example.split("\\t")', "tab split", 1000)
def tab_split_no_limit(STR):
s = STR(GFF3_example)
s_split = s.split
for x in _RANGE_1000:
s_split("\t")
-
- at bench('GFF3_example.split("\\t", 8)', "tab split")
+
+ at bench('GFF3_example.split("\\t", 8)', "tab split", 1000)
def tab_split_limit(STR):
s = STR(GFF3_example)
s_split = s.split
for x in _RANGE_1000:
s_split("\t", 8)
-
- at bench('GFF3_example.rsplit("\\t")', "tab split")
+
+ at bench('GFF3_example.rsplit("\\t")', "tab split", 1000)
def tab_rsplit_no_limit(STR):
s = STR(GFF3_example)
s_rsplit = s.rsplit
for x in _RANGE_1000:
s_rsplit("\t")
-
- at bench('GFF3_example.rsplit("\\t", 8)', "tab split")
+
+ at bench('GFF3_example.rsplit("\\t", 8)', "tab split", 1000)
def tab_rsplit_limit(STR):
s = STR(GFF3_example)
s_rsplit = s.rsplit
@@ -439,7 +447,7 @@
#### Count characters
@bench('...text.with.2000.newlines.count("\\n")',
- "count newlines")
+ "count newlines", 100)
def count_newlines(STR):
s = _get_2000_lines(STR)
s_count = s.count
@@ -503,21 +511,23 @@
_dna = _dna * 50
_dna_unicode = unicode(_dna)
- at bench('dna.count("AACT")', "count AACT substrings in DNA example")
-def count_aact(STR):
+def _get_dna(STR):
if STR is unicode:
- seq = _dna_unicode
- elif STR is str:
- seq = _dna
- else:
- raise AssertionError
+ return _dna_unicode
+ if STR is str:
+ return _dna
+ raise AssertionError
+
+ at bench('dna.count("AACT")', "count AACT substrings in DNA example", 100)
+def count_aact(STR):
+ seq = _get_dna(STR)
seq_count = seq.count
for x in _RANGE_100:
seq_count("AACT")
##### startswith and endswith
- at bench('"Andrew".startswith("A")', 'startswith single character')
+ at bench('"Andrew".startswith("A")', 'startswith single character', 1000)
def startswith_single(STR):
s1 = STR("Andrew")
s2 = STR("A")
@@ -525,7 +535,8 @@
for x in _RANGE_1000:
s1_startswith(s2)
- at bench('"Andrew".startswith("Andrew")', 'startswith multiple characters')
+ at bench('"Andrew".startswith("Andrew")', 'startswith multiple characters',
+ 1000)
def startswith_multiple(STR):
s1 = STR("Andrew")
s2 = STR("Andrew")
@@ -534,7 +545,7 @@
s1_startswith(s2)
@bench('"Andrew".startswith("Anders")',
- 'startswith multiple characters - not!')
+ 'startswith multiple characters - not!', 1000)
def startswith_multiple_not(STR):
s1 = STR("Andrew")
s2 = STR("Anders")
@@ -545,7 +556,7 @@
# endswith
- at bench('"Andrew".endswith("w")', 'endswith single character')
+ at bench('"Andrew".endswith("w")', 'endswith single character', 1000)
def endswith_single(STR):
s1 = STR("Andrew")
s2 = STR("w")
@@ -553,7 +564,7 @@
for x in _RANGE_1000:
s1_endswith(s2)
- at bench('"Andrew".endswith("Andrew")', 'endswith multiple characters')
+ at bench('"Andrew".endswith("Andrew")', 'endswith multiple characters', 1000)
def endswith_multiple(STR):
s1 = STR("Andrew")
s2 = STR("Andrew")
@@ -562,7 +573,7 @@
s1_endswith(s2)
@bench('"Andrew".endswith("Anders")',
- 'endswith multiple characters - not!')
+ 'endswith multiple characters - not!', 1000)
def endswith_multiple_not(STR):
s1 = STR("Andrew")
s2 = STR("Anders")
@@ -572,22 +583,43 @@
#### Strip
- at bench('"Hello!\\n".strip()', 'strip terminal newline')
-def terminal_newline_strip(STR):
+ at bench('"Hello!\\n".strip()', 'strip terminal newline', 1000)
+def terminal_newline_strip_right(STR):
s = STR("Hello!\n")
s_strip = s.strip
for x in _RANGE_1000:
s_strip()
- at bench('"Hello!\\n".rstrip()', 'strip terminal newline')
+ at bench('"Hello!\\n".rstrip()', 'strip terminal newline', 1000)
def terminal_newline_rstrip(STR):
s = STR("Hello!\n")
s_rstrip = s.rstrip
for x in _RANGE_1000:
s_rstrip()
+ at bench('"\\nHello!".strip()', 'strip terminal newline', 1000)
+def terminal_newline_strip_left(STR):
+ s = STR("\nHello!")
+ s_strip = s.strip
+ for x in _RANGE_1000:
+ s_strip()
+
+ at bench('"\\nHello!\\n".strip()', 'strip terminal newline', 1000)
+def terminal_newline_strip_both(STR):
+ s = STR("\nHello!\n")
+ s_strip = s.strip
+ for x in _RANGE_1000:
+ s_strip()
+
+ at bench('"\\nHello!".rstrip()', 'strip terminal newline', 1000)
+def terminal_newline_lstrip(STR):
+ s = STR("\nHello!")
+ s_lstrip = s.lstrip
+ for x in _RANGE_1000:
+ s_lstrip()
+
@bench('s="Hello!\\n"; s[:-1] if s[-1]=="\\n" else s',
- 'strip terminal newline')
+ 'strip terminal newline', 1000)
def terminal_newline_if_else(STR):
s = STR("Hello!\n")
NL = STR("\n")
@@ -595,14 +627,116 @@
s[:-1] if (s[-1] == NL) else s
+# Strip multiple spaces or tabs
+
+ at bench('"Hello\\t \\t".strip()', 'strip terminal spaces and tabs', 1000)
+def terminal_space_strip(STR):
+ s = STR("Hello\t \t!")
+ s_strip = s.strip
+ for x in _RANGE_1000:
+ s_strip()
+
+ at bench('"Hello\\t \\t".rstrip()', 'strip terminal spaces and tabs', 1000)
+def terminal_space_rstrip(STR):
+ s = STR("Hello!\t \t")
+ s_rstrip = s.rstrip
+ for x in _RANGE_1000:
+ s_rstrip()
+
+ at bench('"\\t \\tHello".rstrip()', 'strip terminal spaces and tabs', 1000)
+def terminal_space_lstrip(STR):
+ s = STR("\t \tHello!")
+ s_lstrip = s.lstrip
+ for x in _RANGE_1000:
+ s_lstrip()
+
+
+#### replace
+ at bench('"This is a test".replace(" ", "\\t")', 'replace single character',
+ 1000)
+def replace_single_character(STR):
+ s = STR("This is a test!")
+ from_str = STR(" ")
+ to_str = STR("\t")
+ s_replace = s.replace
+ for x in _RANGE_1000:
+ s_replace(from_str, to_str)
+
+ at bench('re.sub(" ", "\\t", "This is a test"', 'replace single character',
+ 1000)
+def replace_single_character_re(STR):
+ s = STR("This is a test!")
+ pat = re.compile(STR(" "))
+ to_str = STR("\t")
+ pat_sub = pat.sub
+ for x in _RANGE_1000:
+ pat_sub(to_str, s)
+
+ at bench('"...text.with.2000.lines...replace("\\n", " ")',
+ 'replace single character, big string', 100)
+def replace_single_character_big(STR):
+ s = _get_2000_lines(STR)
+ from_str = STR("\n")
+ to_str = STR(" ")
+ s_replace = s.replace
+ for x in _RANGE_100:
+ s_replace(from_str, to_str)
+
+ at bench('re.sub("\\n", " ", "...text.with.2000.lines...")',
+ 'replace single character, big string', 100)
+def replace_single_character_big_re(STR):
+ s = _get_2000_lines(STR)
+ pat = re.compile(STR("\n"))
+ to_str = STR(" ")
+ pat_sub = pat.sub
+ for x in _RANGE_100:
+ pat_sub(to_str, s)
+
+
+ at bench('dna.replace("ATC", "ATT")',
+ 'replace multiple characters, dna', 100)
+def replace_multiple_characters_dna(STR):
+ seq = _get_dna(STR)
+ from_str = STR("ATC")
+ to_str = STR("ATT")
+ seq_replace = seq.replace
+ for x in _RANGE_100:
+ seq_replace(from_str, to_str)
-# strip
-# lstrip
-# rstrip
-# replace
+# This changes the total number of character
+ at bench('"...text.with.2000.newlines.',
+ 'replace multiple characters, big string', 100)
+def replace_multiple_character_big(STR):
+ s = _get_2000_lines(STR)
+ from_str = STR("\n")
+ to_str = STR("\r\n")
+ s_replace = s.replace
+ for x in _RANGE_100:
+ s_replace(from_str, to_str)
+
+# This increases the character count
+ at bench('"...text.with.2000.newlines...replace("\\n", "\\r\\n")',
+ 'replace multiple characters, big string', 100)
+def replace_multiple_character_big(STR):
+ s = _get_2000_lines(STR)
+ from_str = STR("\n")
+ to_str = STR("\r\n")
+ s_replace = s.replace
+ for x in _RANGE_100:
+ s_replace(from_str, to_str)
+
+
+# This decreases the character count
+ at bench('"When shall we three meet again?".replace("ee", "")',
+ 'replace/remove multiple characters', 1000)
+def replace_multiple_character_remove(STR):
+ s = STR("When shall we three meet again?")
+ from_str = STR("ee")
+ to_str = STR("")
+ s_replace = s.replace
+ for x in _RANGE_1000:
+ s_replace(from_str, to_str)
-# rfind
-# rindex
# end of benchmarks
@@ -627,7 +761,7 @@
def main():
test_names = sys.argv[1:]
-
+
bench_functions = []
for (k,v) in globals().items():
if hasattr(v, "is_bench"):
@@ -644,7 +778,7 @@
print "string\tunicode"
print "(in ms)\t(in ms)\t%\tcomment"
- str_total = uni_total = 0
+ str_total = uni_total = 0.0
for title, group in itertools.groupby(bench_functions,
operator.itemgetter(0)):
@@ -655,9 +789,10 @@
"import __main__").best(REPEAT)
uni_time = BenchTimer("__main__.%s(unicode)" % (k,),
"import __main__").best(REPEAT)
- print "%.2f\t%.2f\t%.1f\t%s" % (
+ print "%.2f\t%.2f\t%.1f\t%s (*%d)" % (
1000*str_time, 1000*uni_time, 100.*str_time/uni_time,
- v.comment)
+ v.comment, v.repeat_count)
+
str_total += str_time
uni_total += uni_time
@@ -665,7 +800,6 @@
1000*str_total, 1000*uni_total, 100.*str_total/uni_total,
"TOTAL")
-
if __name__ == "__main__":
main()
-
+
More information about the Python-checkins
mailing list