ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since b4107c8 was
b4107c8,
checked in by Peter A. Buhr <pabuhr@…>, 4 years ago
|
update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages
|
-
Property mode set to
100644
|
File size:
420 bytes
|
Rev | Line | |
---|
[b4107c8] | 1 | import sys |
---|
| 2 | import time |
---|
| 3 | |
---|
| 4 | times = 50000000 |
---|
| 5 | argc = len( sys.argv ) |
---|
| 6 | if argc > 2: |
---|
| 7 | sys.exit( 1 ) |
---|
| 8 | if argc == 2: |
---|
| 9 | times = int( sys.argv[1] ) |
---|
| 10 | |
---|
| 11 | def GreatSuspender(): |
---|
| 12 | while True: |
---|
| 13 | yield |
---|
| 14 | |
---|
| 15 | s = GreatSuspender() |
---|
| 16 | |
---|
| 17 | start = time.time_ns() |
---|
| 18 | for i in range( 10000000 ): |
---|
| 19 | next( s ) # resume |
---|
| 20 | end = time.time_ns() |
---|
| 21 | print( (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.