Skip to content

gh-127617: Trace through __init__ in CALL_ALLOC_AND_ENTER_INIT #127618

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Dec 4, 2024

Benchmark script:

# import time

class Vector:
    def __init__(self, initx, inity, initz):
        self.x = initx

def func(x):
    for i in range(10000000):
        y = Vector(1, 2, 3)




def main():
    import time
    start_time = time.perf_counter()
    import _testinternalcapi
    opt = _testinternalcapi.new_uop_optimizer()
    _testinternalcapi.set_optimizer(opt)
    func(1)
    # func(2.0)
    _testinternalcapi.set_optimizer(None)
    end = time.perf_counter()
    print(f"Time elapsed {end - start_time}")

main()
# func()

Result on main:
Time elapsed 1.5296352980003576

Result here:
Time elapsed 1.432000498999514

Shows the JIT is working I guess :).

@Fidget-Spinner
Copy link
Member Author

Note: this actually performs worse on bm_raytrace.py due to its polymorphism I think. So I would like to hold off merging it bar proper perf analysis/results.

@python-cla-bot
Copy link

python-cla-bot bot commented Apr 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

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