Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Jan 3, 2025

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
Contributor Author

When combined with #128164:

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

Copy link
Contributor

@mpage mpage left a comment

Choose a reason for hiding this comment

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

LGTM!

@colesbury colesbury enabled auto-merge (squash) January 3, 2025 21:26
@colesbury colesbury merged commit f157485 into python:main Jan 3, 2025
35 of 36 checks passed
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 free to 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