[Python-checkins] r46442 - sandbox/trunk/stringbench/stringbench.py

fredrik.lundh python-checkins at python.org
Sat May 27 13:22:58 CEST 2006


Author: fredrik.lundh
Date: Sat May 27 13:22:58 2006
New Revision: 46442

Modified:
   sandbox/trunk/stringbench/stringbench.py
Log:
whitespace normalization



Modified: sandbox/trunk/stringbench/stringbench.py
==============================================================================
--- sandbox/trunk/stringbench/stringbench.py	(original)
+++ sandbox/trunk/stringbench/stringbench.py	Sat May 27 13:22:58 2006
@@ -107,7 +107,7 @@
     search = pat.search
     for x in _RANGE_100:
         search(s1)
-        
+
 
 #### same tests as 'in' but use 'find'
 
@@ -170,7 +170,7 @@
 # Skip the ones which fail because that would include exception overhead.
 # Add rindex tests.
 
-        
+
 @bench('("A"*1000).index("A")', "early match, single character", 1000)
 def index_test_quick_match_single_character(STR):
     s1 = STR("A" * 1000)
@@ -231,7 +231,7 @@
     s = STR("ABCDE")
     for x in _RANGE_1000:
         s * 1000
-        
+
 # + for concat
 
 @bench('"Andrew"+"Dalke"', "concat two strings", 1000)
@@ -423,14 +423,14 @@
     for x in _RANGE_1000:
         s_split("\n")
 
-        
+
 @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")
-        
+
 @bench('"this\\nis\\na\\ntest\\n".splitlines()', "split newlines", 1000)
 def newlines_splitlines(STR):
     s = STR("this\nis\na\ntest\n")
@@ -439,7 +439,7 @@
         s_splitlines()
 
 ## split text with 2000 newlines
-    
+
 def _make_2000_lines():
     import random
     r = random.Random(100)
@@ -465,7 +465,7 @@
     if STR is str:
         return _text_with_2000_lines
     raise AssertionError
-        
+
 
 @bench('"...text...".split("\\n")', "split 2000 newlines", 10)
 def newlines_split_2000(STR):
@@ -473,14 +473,14 @@
     s_split = s.split
     for x in _RANGE_10:
         s_split("\n")
-        
+
 @bench('"...text...".rsplit("\\n")', "split 2000 newlines", 10)
 def newlines_rsplit_2000(STR):
     s = _get_2000_lines(STR)
     s_rsplit = s.rsplit
     for x in _RANGE_10:
         s_rsplit("\n")
-        
+
 @bench('"...text...".splitlines()', "split 2000 newlines", 10)
 def newlines_splitlines_2000(STR):
     s = _get_2000_lines(STR)
@@ -515,7 +515,7 @@
     s_split = s.split
     for x in _RANGE_10:
         s_split("ACTAT")
-        
+
 @bench('dna.rsplit("ACTAT")',
        "split on multicharacter separator (dna)", 10)
 def rsplit_multichar_sep_dna(STR):
@@ -538,21 +538,21 @@
     s_split = s.split
     for x in _RANGE_1000:
         s_split("\t")
-        
+
 @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)
-        
+
 @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")
-        
+
 @bench('GFF3_example.rsplit("\\t", 8)', "tab split", 1000)
 def tab_rsplit_limit(STR):
     s = STR(GFF3_example)
@@ -766,7 +766,7 @@
     for x in _RANGE_1000:
         s_lstrip()
 
-        
+
 #### replace
 @bench('"This is a test".replace(" ", "\\t")', 'replace single character',
        1000)
@@ -978,7 +978,7 @@
     (options, test_names) = parser.parse_args()
     if options.str_only and options.unicode_only:
         raise SystemExit("Only one of --8-bit and --unicode are allowed")
-    
+
     bench_functions = []
     for (k,v) in globals().items():
         if hasattr(v, "is_bench"):
@@ -991,7 +991,7 @@
                     continue
             if options.skip_re and hasattr(v, "uses_re"):
                 continue
-            
+
             bench_functions.append( (v.group, k, v) )
     bench_functions.sort()
 
@@ -1039,4 +1039,4 @@
 
 if __name__ == "__main__":
     main()
-    
+


More information about the Python-checkins mailing list