Visitar URL original
Optimizing `super().meth()` via adaptive superinstructions · Issue #242 · faster-cpython/ideas · GitHub
Skip to content

Optimizing super().meth() via adaptive superinstructions #242

Description

@Fidget-Spinner

Please see #239 for the discussion and https://bugs.python.org/issue46564 for the BPO.

Activity

  1. Fidget-Spinner commented on Jan 28, 2022

    @Fidget-Spinner
    CollaboratorAuthor

    CPython PR is at python/cpython#30992.

  2. Fidget-Spinner commented on Mar 15, 2022

    @Fidget-Spinner
    CollaboratorAuthor

    @markshannon your 3.11 TODO reminded me that this is dead in the water. Do you think this will ever be worth it?

    With the new inline cache infrastructure. It is easier to share caches across multiple instructions. But IMO the complexity involved makes it unpalatable.

    For the record, the PR above measured no speedups in pyperformance, but in super() microbenchmarks, it saw super().meth() speeding up by nearly 2.2x. With super().meth() now only having a ~10% slowdown over self.meth() (basically, non-existent in the real world), versus a 2x slowdown previously. In fact, the new super.meth() is as fast as or even faster than pre-3.11 plain self.meth() calls thanks to caching of method lookups.

  3. gvanrossum commented on Mar 15, 2022

    @gvanrossum
    Collaborator

    Hi @Fidget-Spinner I'm a little confused about what you're saying at the end. I understand the PR (that won't ever be merged) saw a 2.2 speedup. After that, are you saying that in the main branch, super().meth() is now 10% slower than self.meth(), which is an improvement over that ratio for 3.10?

  4. Fidget-Spinner commented on Mar 15, 2022

    @Fidget-Spinner
    CollaboratorAuthor

    @gvanrossum Sorry, I meant specifically in that PR, super().meth() is only 10% slower than self.meth(). In 3.10, super().meth() was around 2x slower than self.meth().

    On main, it should still be around 2x slower. Although we optimized super() with vectorcall support, we also optimized self.meth() via specialization. Most likely the latter outstrips the former. I have yet to benchmark main recently.

  5. gvanrossum commented on Sep 13, 2023

    @gvanrossum
    Collaborator

    @Fidget-Spinner Do we still need this issue?

  6. Fidget-Spinner commented on Sep 13, 2023

    @Fidget-Spinner
    CollaboratorAuthor

    @gvanrossum Nope. Carl has has merged his version, so it's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions