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

Loop unrolling #1

Open
tmbb opened this issue Jul 22, 2017 · 1 comment
Open

Loop unrolling #1

tmbb opened this issue Jul 22, 2017 · 1 comment

Comments

@tmbb
Copy link
Contributor

tmbb commented Jul 22, 2017

You say that:

The repeat parser repeats over a parser for bounded number of times, returning
the results as a list. It does have a slight overhead compared to known
execution times due to an anonmous function call, but that is necessary when
performing a dynamic number of repetitions without mutable variables.

A possible optimization would be to have some degree of "loop unrolling", if performance measuerements show it's helpful. The degree of unrolling could even be specified by the user, with a iterations_per_function_call parameter. For known maximum counts you could eliminate recursion completely (for a reasonably low number of maximum counts)

@OvermindDL1
Copy link
Owner

A possible optimization would be to have some degree of "loop unrolling", if performance measuerements show it's helpful. The degree of unrolling could even be specified by the user, with a iterations_per_function_call parameter. For known maximum counts you could eliminate recursion completely (for a reasonably low number of maximum counts)

Hmm, that is possible. Perhaps an unroll of an inline call up to a user-specified max (with a trade-off of larger code generation) before it calls back to anonymous function calls. I'll leave this open to remind me for when I get time to put it in. Or feel free to PR it. :-)

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

No branches or pull requests

2 participants