Lines Matching refs:bench
57 def bench(s, group, repeat_count): function
75 @bench('"A" in "A"*1000', "early match, single character", 1000)
82 @bench('"B" in "A"*1000', "no match, single character", 1000)
90 @bench('"AB" in "AB"*1000', "early match, two characters", 1000)
97 @bench('"BC" in "AB"*1000', "no match, two characters", 1000)
104 @bench('"BC" in ("AB"*300+"C")', "late match, two characters", 1000)
111 @bench('s="ABC"*33; (s+"E") in ((s+"D")*300+s+"E")',
124 @bench('s="ABC"*33; re.compile(s+"D").search((s+"D")*300+s+"E")',
140 @bench('("A"*1000).find("A")', "early match, single character", 1000)
148 @bench('("A"*1000).find("B")', "no match, single character", 1000)
157 @bench('("AB"*1000).find("AB")', "early match, two characters", 1000)
165 @bench('("AB"*1000).find("BC")', "no match, two characters", 1000)
173 @bench('("AB"*1000).find("CA")', "no match, two characters", 1000)
181 @bench('("AB"*300+"C").find("BC")', "late match, two characters", 1000)
189 @bench('("AB"*300+"CA").find("CA")', "late match, two characters", 1000)
197 @bench('s="ABC"*33; ((s+"D")*500+s+"E").find(s+"E")',
209 @bench('s="ABC"*33; ((s+"D")*500+"E"+s).find("E"+s)',
224 @bench('("A"*1000).rfind("A")', "early match, single character", 1000)
232 @bench('("A"*1000).rfind("B")', "no match, single character", 1000)
241 @bench('("AB"*1000).rfind("AB")', "early match, two characters", 1000)
249 @bench('("AB"*1000).rfind("BC")', "no match, two characters", 1000)
257 @bench('("AB"*1000).rfind("CA")', "no match, two characters", 1000)
265 @bench('("C"+"AB"*300).rfind("CA")', "late match, two characters", 1000)
273 @bench('("BC"+"AB"*300).rfind("BC")', "late match, two characters", 1000)
281 @bench('s="ABC"*33; ("E"+s+("D"+s)*500).rfind("E"+s)',
293 @bench('s="ABC"*33; (s+"E"+("D"+s)*500).rfind(s+"E")',
309 @bench('("A"*1000).index("A")', "early match, single character", 1000)
317 @bench('("AB"*1000).index("AB")', "early match, two characters", 1000)
325 @bench('("AB"*300+"C").index("BC")', "late match, two characters", 1000)
333 @bench('s="ABC"*33; ((s+"D")*500+s+"E").index(s+"E")',
348 @bench('("A"*1000).rindex("A")', "early match, single character", 1000)
356 @bench('("AB"*1000).rindex("AB")', "early match, two characters", 1000)
364 @bench('("C"+"AB"*300).rindex("CA")', "late match, two characters", 1000)
372 @bench('s="ABC"*33; ("E"+s+("D"+s)*500).rindex("E"+s)',
387 @bench('("A"*1000).partition("A")', "early match, single character", 1000)
395 @bench('("A"*1000).partition("B")', "no match, single character", 1000)
404 @bench('("AB"*1000).partition("AB")', "early match, two characters", 1000)
412 @bench('("AB"*1000).partition("BC")', "no match, two characters", 1000)
420 @bench('("AB"*300+"C").partition("BC")', "late match, two characters", 1000)
428 @bench('s="ABC"*33; ((s+"D")*500+s+"E").partition(s+"E")',
443 @bench('("A"*1000).rpartition("A")', "early match, single character", 1000)
451 @bench('("A"*1000).rpartition("B")', "no match, single character", 1000)
460 @bench('("AB"*1000).rpartition("AB")', "early match, two characters", 1000)
468 @bench('("AB"*1000).rpartition("BC")', "no match, two characters", 1000)
476 @bench('("C"+"AB"*300).rpartition("CA")', "late match, two characters", 1000)
484 @bench('s="ABC"*33; ("E"+s+("D"+s)*500).rpartition("E"+s)',
499 @bench('("A"*1000).split("A", 1)', "early match, single character", 1000)
507 @bench('("A"*1000).split("B", 1)', "no match, single character", 1000)
516 @bench('("AB"*1000).split("AB", 1)', "early match, two characters", 1000)
524 @bench('("AB"*1000).split("BC", 1)', "no match, two characters", 1000)
532 @bench('("AB"*300+"C").split("BC", 1)', "late match, two characters", 1000)
540 @bench('s="ABC"*33; ((s+"D")*500+s+"E").split(s+"E", 1)',
555 @bench('("A"*1000).rsplit("A", 1)', "early match, single character", 1000)
563 @bench('("A"*1000).rsplit("B", 1)', "no match, single character", 1000)
572 @bench('("AB"*1000).rsplit("AB", 1)', "early match, two characters", 1000)
580 @bench('("AB"*1000).rsplit("BC", 1)', "no match, two characters", 1000)
588 @bench('("C"+"AB"*300).rsplit("CA", 1)', "late match, two characters", 1000)
596 @bench('s="ABC"*33; ("E"+s+("D"+s)*500).rsplit("E"+s, 1)',
611 @bench('"A"*10', "repeat 1 character 10 times", 1000)
617 @bench('"A"*1000', "repeat 1 character 1000 times", 1000)
623 @bench('"ABCDE"*10', "repeat 5 characters 10 times", 1000)
629 @bench('"ABCDE"*1000', "repeat 5 characters 1000 times", 1000)
637 @bench('"Andrew"+"Dalke"', "concat two strings", 1000)
644 @bench('s1+s2+s3+s4+...+s20', "concat 20 strings of words length 4 to 15",
679 @bench('"A".join("")',
688 @bench('"ABCDE".join("")',
697 @bench('"A".join("ABC..Z")',
706 @bench('"ABCDE".join("ABC..Z")',
715 @bench('"A".join(list("ABC..Z"))',
724 @bench('"ABCDE".join(list("ABC..Z"))',
733 @bench('"A".join(["Bob"]*100)',
742 @bench('"ABCDE".join(["Bob"]*100))',
753 @bench('("Here are some words. "*2).split()', "split whitespace (small)", 1000)
760 @bench('("Here are some words. "*2).rsplit()', "split whitespace (small)", 1000)
767 @bench('("Here are some words. "*2).split(None, 1)',
776 @bench('("Here are some words. "*2).rsplit(None, 1)',
785 @bench('("Here are some words. "*2).partition(" ")',
794 @bench('("Here are some words. "*2).rpartition(" ")',
827 @bench('human_text.split()', "split whitespace (huge)", 10)
834 @bench('human_text.rsplit()', "split whitespace (huge)", 10)
843 @bench('"this\\nis\\na\\ntest\\n".split("\\n")', "split newlines", 1000)
852 @bench('"this\\nis\\na\\ntest\\n".rsplit("\\n")', "split newlines", 1000)
860 @bench('"this\\nis\\na\\ntest\\n".splitlines()', "split newlines", 1000)
897 @bench('"...text...".split("\\n")', "split 2000 newlines", 10)
905 @bench('"...text...".rsplit("\\n")', "split 2000 newlines", 10)
913 @bench('"...text...".splitlines()', "split 2000 newlines", 10)
922 @bench(
931 @bench(
942 @bench('dna.split("ACTAT")',
951 @bench('dna.rsplit("ACTAT")',
968 @bench('GFF3_example.split("\\t")', "tab split", 1000)
976 @bench('GFF3_example.split("\\t", 8)', "tab split", 1000)
984 @bench('GFF3_example.rsplit("\\t")', "tab split", 1000)
992 @bench('GFF3_example.rsplit("\\t", 8)', "tab split", 1000)
1002 @bench('...text.with.2000.newlines.count("\\n")',
1076 @bench('dna.count("AACT")', "count AACT substrings in DNA example", 10)
1086 @bench('"Andrew".startswith("A")', 'startswith single character', 1000)
1094 @bench('"Andrew".startswith("Andrew")', 'startswith multiple characters',
1103 @bench('"Andrew".startswith("Anders")',
1115 @bench('"Andrew".endswith("w")', 'endswith single character', 1000)
1123 @bench('"Andrew".endswith("Andrew")', 'endswith multiple characters', 1000)
1131 @bench('"Andrew".endswith("Anders")',
1142 @bench('"Hello!\\n".strip()', 'strip terminal newline', 1000)
1149 @bench('"Hello!\\n".rstrip()', 'strip terminal newline', 1000)
1156 @bench('"\\nHello!".strip()', 'strip terminal newline', 1000)
1163 @bench('"\\nHello!\\n".strip()', 'strip terminal newline', 1000)
1170 @bench('"\\nHello!".rstrip()', 'strip terminal newline', 1000)
1177 @bench('s="Hello!\\n"; s[:-1] if s[-1]=="\\n" else s',
1188 @bench('"Hello\\t \\t".strip()', 'strip terminal spaces and tabs', 1000)
1195 @bench('"Hello\\t \\t".rstrip()', 'strip terminal spaces and tabs', 1000)
1202 @bench('"\\t \\tHello".rstrip()', 'strip terminal spaces and tabs', 1000)
1211 @bench('"This is a test".replace(" ", "\\t")', 'replace single character',
1222 @bench('re.sub(" ", "\\t", "This is a test"', 'replace single character',
1232 @bench('"...text.with.2000.lines...replace("\\n", " ")',
1243 @bench('re.sub("\\n", " ", "...text.with.2000.lines...")',
1254 @bench('dna.replace("ATC", "ATT")',
1265 @bench('"...text.with.2000.newlines...replace("\\n", "\\r\\n")',
1277 @bench('"When shall we three meet again?".replace("ee", "")',
1298 @bench('("A" + ("Z"*128*1024)).replace("A", "BB", 1)',
1308 @bench('("A" + ("Z"*128*1024)).replace("AZZ", "BBZZ", 1)',
1348 @bench('"The %(k1)s is %(k2)s the %(k3)s."%{"k1":"x","k2":"y","k3":"z",}',
1359 @bench('("Where in the world is Carmen San Deigo?"*10).lower()',
1367 @bench('("WHERE IN THE WORLD IS CARMEN SAN DEIGO?"*10).lower()',
1376 @bench('("wHERE IN THE WORLD IS cARMEN sAN dEIGO?"*10).upper()',
1384 @bench('("where in the world is carmen san deigo?"*10).upper()',