<s> '''<STR_LIT>''' <EOL> from time import time <EOL> from time import sleep <EOL> import threading <EOL> def main ( ) : <EOL> if PYTHON == '<STR_LIT>' : <EOL> pythonjs . configure ( direct_operator = '<STR_LIT:+>' ) <EOL> pass <EOL> starttime = time ( ) <EOL> n = <NUM_LIT> <EOL> seq = [ ] <EOL> cache = [ ] <EOL> w1 = threading . start_webworker ( worker , ( <NUM_LIT:0> , n , seq , cache ) ) <EOL> sleep ( <NUM_LIT:1.0> ) <EOL> testtime = time ( ) - starttime <EOL> primes_per_sec = len ( seq ) * ( <NUM_LIT:1.0> / testtime ) <EOL> print ( primes_per_sec ) <EOL> print ( '<STR_LIT>' % testtime ) <EOL> print ( '<STR_LIT>' ) <EOL> with webworker : <EOL> def worker ( start , end , seq , cache ) : <EOL> print ( '<STR_LIT>' ) <EOL> for i in range ( start , end ) : <EOL> if i in cache : <EOL> pass <EOL> else : <EOL> cache . append ( i ) <EOL> if is_prime ( i ) : <EOL> seq . append ( i ) <EOL> print ( '<STR_LIT>' % i ) <EOL> def is_prime ( n ) : <EOL> hits = <NUM_LIT:0> <EOL> for x in range ( <NUM_LIT:2> , n ) : <EOL> for y in range ( <NUM_LIT:2> , n ) : <EOL> if x * y == n : <EOL> hits += <NUM_LIT:1> <EOL> if hits > <NUM_LIT:1> : <EOL> return False <EOL> return True </s>
