-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Apply doesn't need to check its argument entirely #686
Comments
shirok
changed the title
Apply doesn't need to check it's argument entirely
Apply doesn't need to check its argument entirely
May 3, 2020
pclouds
added a commit
to pclouds/Gauche
that referenced
this issue
May 21, 2020
The function check_arglist_tail_for_apply() goes to the end of the list to determine the length, and whether it's circular. In many cases we don't really need to know its full length, just whether it's above a certain limit. Make the function accept an upper limit and terminate early in these cases. We could be a bit faster in the pathological case where we know in advance how many number a procedure may take and we have to handle a list of a zillion elements. In one case where we have to unpack the entire argument list, there will be no upper limit. This could be the first step to fixing issue shirok#686 too.
shirok
pushed a commit
that referenced
this issue
May 21, 2020
The function check_arglist_tail_for_apply() goes to the end of the list to determine the length, and whether it's circular. In many cases we don't really need to know its full length, just whether it's above a certain limit. Make the function accept an upper limit and terminate early in these cases. We could be a bit faster in the pathological case where we know in advance how many number a procedure may take and we have to handle a list of a zillion elements. In one case where we have to unpack the entire argument list, there will be no upper limit. This could be the first step to fixing issue #686 too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If a lazy infinite list is passed to apply, it'll exhaust memory while checking the length of the argument list. But we only need to check up to match the # of required arguments.
Related to #684
The text was updated successfully, but these errors were encountered: