Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesburycolesbury 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
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)

Copy link
Contributor

@mpagempage left a comment

Choose a reason for hiding this comment

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

LGTM!

Co-authored-by: mpage <mpage@cs.stanford.edu>
@colesburycolesbury enabled auto-merge (squash) January 3, 2025 21:26
@colesburycolesbury merged commit f157485 into python:mainJan 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.
@colesburycolesbury 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