Skip to content

Tail Call Optimization #38

@RealA10N

Description

@RealA10N

Shouldn't be hard to implement a basic tail recursion optimization: If the last operation in a function is a call to the same function, replace the call with jump to start. 1

Clinger98 is probably a good start. I came up with this issue after seeing the added tail call interpreter to Python 3.14, although it seems quite different than this optimization. 2

Footnotes

  1. https://en.wikipedia.org/wiki/Tail_call

  2. https://x.com/charliermarsh/status/1888384047682093248?s=46&t=yUnnWYe3WhbU_1enl6udgw

Metadata

Metadata

Assignees

No one assigned

    Labels

    optimizationA suggestion for a new USM optimization

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions