File tree Expand file tree Collapse file tree 1 file changed +26
-5
lines changed
Expand file tree Collapse file tree 1 file changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -81,25 +81,45 @@ def parse_cssutils():
8181
8282
8383def check_consistency ():
84+ result = parse_python ()
8485#import pprint
85- #pprint.pprint(parse_python())
86- result = parse_cython ()
86+ #pprint.pprint(result)
8787assert len (result ) > 0
88- assert parse_python () == result
88+ if tokenizer .cython_tokenize_flat :
89+ assert parse_cython () == result
8990assert parse_cssutils () == result
9091version = '.' .join (map (str , sys .version_info [:3 ]))
9192print ('Python{}, consistency OK.' .format (version ))
9293
9394
95+ def warm_up ():
96+ is_pypy = hasattr (sys , 'pypy_translation_info' )
97+ if is_pypy :
98+ print ('Warming up for PyPy...' )
99+ for i in range (80 ):
100+ for i in range (10 ):
101+ parse_python ()
102+ parse_cssutils ()
103+ sys .stdout .write ('.' )
104+ sys .stdout .flush ()
105+ sys .stdout .write ('\n ' )
106+
107+
94108def time (function ):
95109seconds = timeit .Timer (function ).repeat (TIMEIT_REPEAT , TIMEIT_NUMBER )
96110miliseconds = int (min (seconds ) * 1000 )
97111return miliseconds
98112
99113
100114def run ():
101- data_set = [
102- ('tinycss + speedups ' , parse_cython ),
115+ if tokenizer .cython_tokenize_flat :
116+ data_set = [
117+ ('tinycss + speedups ' , parse_cython ),
118+ ]
119+ else :
120+ print ('Speedups are NOT available.' )
121+ data_set = []
122+ data_set += [
103123 ('tinycss WITHOUT speedups' , parse_python ),
104124 ('cssutils ' , parse_cssutils ),
105125 ]
@@ -113,4 +133,5 @@ def run():
113133
114134if __name__ == '__main__' :
115135check_consistency ()
136+ warm_up ()
116137run ()
You can’t perform that action at this time.
0 commit comments