Skip to content

Commit 17a8945

Browse files
committed
Add documentation.
1 parent 0753676 commit 17a8945

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

graalpython/com.oracle.graal.python.benchmarks/python/micro/phase_shift_warmup.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@
4141
import subprocess, sys, re
4242

4343

44+
# This benchmark executes the script phase_shift_script in a subprocess.
45+
# The phase_shift_script script runs in two phases. The first phase runs (phase1it)
46+
# iterations of a certain workflow consisting of a large number of generated functions.
47+
# The second phase runs (phase2it + 200) iterations of a different workflow consisting
48+
# of a large, but approx. 5 times smaller, number of other generated
49+
# functions and measures the sum of the time of the last 200 iterations.
50+
# The better the time the better is the code of the second phase workflow
51+
# warmed up. Since the second phase runs after the first phase, the compilation queue
52+
# is pretty filled up when the second phase starts. This benchmark measures how
53+
# well the compilation queue performs in this situation, which can be compared
54+
# with the phase_shift_warmup_baseline benchmark, where the same workflow starts
55+
# with a clean compilation queue.
4456
def __benchmark__(phase1it=0, phase2it=0):
4557
orig_vm_argv = sys.orig_argv
4658
for i, arg in enumerate(orig_vm_argv):

graalpython/com.oracle.graal.python.benchmarks/python/micro/phase_shift_warmup_baseline.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
import subprocess, sys, re
4242

4343

44+
# This benchmark computes the best possible result of the phase_shift_warmup
45+
# benchmark. It executes the script phase_shift_script_baseline in a subprocess.
46+
# The phase_shift_script_baseline script runs only the second phase of the
47+
# full script phase_shift_script, and so the second phase starts with a clean
48+
# compilation queue. The second phase runs (phase2it + 200) iterations of a
49+
# certain workflow consisting of a large number of generated functions and measures
50+
# the sum of the time of the last 200 iterations. The better the time the better
51+
# is the code of the tested workflow warmed up.
4452
def __benchmark__(phase2it=0):
4553
orig_vm_argv = sys.orig_argv
4654
for i, arg in enumerate(orig_vm_argv):
@@ -55,5 +63,6 @@ def __benchmark__(phase2it=0):
5563
m = re.search(r"LAST_200_IT_TIME = (\d+) ms", result.stdout)
5664
if m:
5765
tt = int(m.group(1))
66+
print(result.stdout)
5867
return tt * 1000000
5968

0 commit comments

Comments
 (0)