Skip to content

Commit 4bd251e

Browse files
committed
fine tune parameters
1 parent 4e12f04 commit 4bd251e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ extern "C" {
2020
* PYTHON_JIT_FITNESS_INITIAL and PYTHON_JIT_FITNESS_INITIAL_SIDE */
2121
#define FITNESS_PER_INSTRUCTION 2
2222
#define FITNESS_BRANCH_BASE 5
23-
#define FITNESS_INITIAL (FITNESS_PER_INSTRUCTION * 1000)
24-
#define FITNESS_INITIAL_SIDE (FITNESS_INITIAL / 2)
23+
#define FITNESS_INITIAL (UOP_MAX_TRACE_LENGTH * FITNESS_PER_INSTRUCTION)
24+
#define FITNESS_INITIAL_SIDE (FITNESS_INITIAL * 3 / 5)
2525
#define FITNESS_BACKWARD_EDGE (FITNESS_INITIAL / 10)
2626

2727
/* Exit quality constants for fitness-based trace termination.

Python/optimizer.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ compute_exit_quality(_Py_CODEUNIT *target_instr, int opcode,
633633
static inline int32_t
634634
compute_frame_penalty(const _PyOptimizationConfig *cfg)
635635
{
636-
return (int32_t)cfg->fitness_initial / 10 + 1;
636+
return (int32_t)cfg->fitness_initial / 30 + 1;
637637
}
638638

639639
static int
@@ -2219,7 +2219,11 @@ _PyDumpExecutors(FILE *out)
22192219
fprintf(out, " node [colorscheme=greys9]\n");
22202220
PyInterpreterState *interp = PyInterpreterState_Get();
22212221
for (size_t i = 0; i < interp->executor_count; i++) {
2222-
executor_to_gv(interp->executor_ptrs[i], out);
2222+
_PyExecutorObject *exec = interp->executor_ptrs[i];
2223+
if (exec->vm_data.code == NULL) {
2224+
continue;
2225+
}
2226+
executor_to_gv(exec, out);
22232227
}
22242228
fprintf(out, "}\n\n");
22252229
return 0;

0 commit comments

Comments
 (0)