source: benchmark/ctxswitch/python_cor.py @ dfda49f

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since dfda49f was 2316525, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

update benchmarks for concurrency paper

  • Property mode set to 100644
File size: 394 bytes
RevLine 
[b4107c8]1import sys
2import time
3
4times = 50000000
5argc = len( sys.argv )
6if argc > 2:
7        sys.exit( 1 )
8if argc == 2:
9        times = int( sys.argv[1] )
10
[2316525]11def C():
[b4107c8]12        while True:
13                yield
14
[2316525]15c = C()
[b4107c8]16
17start = time.time_ns()
18for i in range( 10000000 ):
[2316525]19        next( c )  # resume
[b4107c8]20end = time.time_ns()
21print( (end - start) / times )
22
23# Local Variables: #
24# tab-width: 4 #
25# compile-command: "python3.7 python_cor.py" #
26# End: #
Note: See TracBrowser for help on using the repository browser.