Skip to content

gh-125985: Fix cmodule_function() scaling benchmark - #128460

Merged
colesbury merged 2 commits into
python:mainfrom
colesbury:gh-125985-scaling-bench
Jan 3, 2025
Merged

gh-125985: Fix cmodule_function() scaling benchmark#128460
colesbury merged 2 commits into
python:mainfrom
colesbury:gh-125985-scaling-bench

Conversation

@colesbury

@colesburycolesbury commented Jan 3, 2025

Copy link
Copy Markdown
Contributor

Add a separate benchmark that measures the effect of _PyObject_LookupSpecial() on scaling.

In the process of cleaning up the scaling benchmarks for inclusion, I unintentionally changed the cmodule_function benchmark to pass an int to math.floor(), which causes it to use the _PyObject_LookupSpecial() code path. _PyObject_LookupSpecial() has its own scaling issues that we want to measure separately.

Add a separate benchmark that measures the effect of
`_PyObject_LookupSpecial()` on scaling.
In the process of cleaning up the scaling benchmarks for inclusion, I
unintentionally changed the "cmodule_function" benchmark to pass an
`int` to `math.floor()` instead of a `float`, which causes it to use the
`_PyObject_LookupSpecial()` code path. `_PyObject_LookupSpecial()` has
its own scaling issues that we want to measure separately from calling a
function on a C module.
@colesbury

Copy link
Copy Markdown
ContributorAuthor

When combined with #128164:

  • cmodule_function now scales well (14.9x faster)
  • object_lookup_special demonstrates the issue with _PyObject_LookupSpecial (1.3x slower)

@mpagempage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment threadTools/ftscalingbench/ftscalingbench.py Outdated
Co-authored-by: mpage <mpage@cs.stanford.edu>
@colesbury
colesbury enabled auto-merge (squash) January 3, 2025 21:26
@colesbury
colesbury merged commit f157485 into python:mainJan 3, 2025
WolframAlph pushed a commit to WolframAlph/cpython that referenced this pull request Jan 4, 2025
…28460)
Add a separate benchmark that measures the effect of
`_PyObject_LookupSpecial()` on scaling.
In the process of cleaning up the scaling benchmarks for inclusion, I
unintentionally changed the "cmodule_function" benchmark to pass an
`int` to `math.floor()` instead of a `float`, which causes it to use the
`_PyObject_LookupSpecial()` code path. `_PyObject_LookupSpecial()` has
its own scaling issues that we want to measure separately from calling a
function on a C module.
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
…28460)
Add a separate benchmark that measures the effect of
`_PyObject_LookupSpecial()` on scaling.
In the process of cleaning up the scaling benchmarks for inclusion, I
unintentionally changed the "cmodule_function" benchmark to pass an
`int` to `math.floor()` instead of a `float`, which causes it to use the
`_PyObject_LookupSpecial()` code path. `_PyObject_LookupSpecial()` has
its own scaling issues that we want to measure separately from calling a
function on a C module.
@colesbury
colesbury deleted the gh-125985-scaling-bench branch February 28, 2025 15:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@colesbury@mpage