Skip to content
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

Add Stream Sieve benchmark from Typed Racket #466

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

hugomg
Copy link
Member

@hugomg hugomg commented Aug 18, 2021

Closes #427.

This is a nice benchmark from the gradual typing literature but it has a problem... it hits the LUAI_MAXCCALLS limit due to too much recursion. I think I'll leave it here as a draft pull-request for now.

@hugomg
Copy link
Member Author

hugomg commented Aug 18, 2021

There is a chance that this might stop blowing the stack if we implement tail recursion optimization (#211). It might also benefit from proper recursive types (#85), because there is one place where the as Stream cast makes the function no longer tail recursive.

@hugomg
Copy link
Member Author

hugomg commented Aug 18, 2021

Another pre-requesite is optimizing indirect Pallene->Pallene calls (#354). Tail-call optimization is not possible for functions that cross a Pallene<->Lua boundary.

@hugomg
Copy link
Member Author

hugomg commented Aug 18, 2021

Scratch that... It turns out that the benchmark isn't actually tail recursive. There are some function calls that are, but there are some that are not. In particular, the part in sift that happens before the % n == 0 check.

@srijan-paul
Copy link
Member

srijan-paul commented Aug 20, 2021

Does this run in any of the regular lua interpreters?

@hugomg
Copy link
Member Author

hugomg commented Aug 20, 2021

It works fine in Lua because the call stack limit is much higher (millions of calls, instead of hundreds of calls)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the Stream Sieve benchmark
2 participants