bpo-45510: Specialize BINARY_SUBTRACT#29010
Conversation
|
🤖 New build scheduled with the buildbot fleet by @corona10 for commit fb360a2b562300ac17a10c49b43e0f496f51a0ee 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
🤖 New build scheduled with the buildbot fleet by @corona10 for commit b4608cca7dccaf21358e4da854d0701cbe0d0e01 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
The reason of build bot failure looks same with #29024 |
ad423f5 to
a010e2d
Compare
|
@markshannon Rebased! |
|
Sorry about the conflicts. I wanted to get both the CALL_FUNCTION specializations PRs merged. |
a010e2d to
6b27e1f
Compare
I can do this all day :) |
|
A marginal speedup My concern with this change is that it will slow down any subtraction on anything other than pairs of ints and floats. Note that |
I share the same concerns |
|
@markshannon cc @pablogsal @Fidget-Spinner
I definitely agree with your concern. So do I, At first, I thought that it's okayish since we already have the issue with
Whether merge this PR or not, it's worth measuring such benchmarks, we can get some data from this experiment. |
|
@markshannon For your data
Benchmark hidden because not significant (1): float - int from pyperf import Runner
runner = Runner()
runner.timeit("int - int",
setup="""
import random
a = random.randint(1, 1000000)
b = random.randint(1, 1000000)
""",
stmt="""
x = a - b
""")
runner.timeit("float - float",
setup="""
import random
a = random.uniform(1.5, 3.9)
b = random.uniform(1.5, 3.9)
""",
stmt="""
x = a - b
"""
)
runner.timeit("int - float",
setup="""
import random
a = random.randint(1, 100000)
b = random.uniform(1.5, 3.9)
""",
stmt="""
x = a - b
"""
)
runner.timeit("float - int",
setup="""
import random
a = random.randint(1, 100000)
b = random.uniform(1.5, 3.9)
""",
stmt="""
x = b - a
"""
)
runner.timeit("decimal - decimal",
setup="""
import random
from decimal import Decimal as D
a = D(random.randint(1, 100000))
b = D(random.randint(1, 100000))
""",
stmt="""
x = a - b
"""
) |
Experiment 2
Benchmark hidden because not significant (1): float - int |
|
Unreliable my VM test with experiment2. :)
Benchmark hidden because not significant (16): float, go, json_loads, logging_silent, nbody, pickle_dict, pickle_pure_python, pidigits, pyflate, richards, scimark_fft, scimark_lu, scimark_monte_carlo, scimark_sparse_mat_mult, sqlite_synth, unpickle_list |
|
Will need reworking once #29482 is merged. Sorry to make you redo this, yet again 🙁 I think the end result will be better though, as we won't need yet another |
|
@markshannon |
|
Should this PR be closed (in favor of #29523)? |
faster-cpython/ideas#100
https://bugs.python.org/issue45510