-
Notifications
You must be signed in to change notification settings - Fork 5
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
Collapse f_and/f_or for better performance? #320
Comments
I looked into it and don't think there's much that can be done.
|
Reopened after changing my mind about it. I think it should be possible to do something about this after all. |
rohanpm
added a commit
that referenced
this issue
Mar 8, 2022
Add special-case handling to flatten the data structure when chaining multiple AND/OR together; for example, make f_and(f_and(x, y), z) work approximately in the same way as f_and(x, y, z). The goal here is to avoid a stack overflow when using a pattern which can chain a large number of futures. Previously, an overflow could start to happen if the chain was a few hundred futures deep, since each future's completion callback would set the result on the next future which would invoke another completion callback and so on throughout the chain. Fixes #320
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following:
That will create various chained objects (AndOperation under the hood). In practice code might be written in a way such that the chain ends up thousands of items deep.
Consider if it's practical & useful to collapse the objects in this case. e.g. is it possible to arrange it so that, in
f_and(a, f_and(b, c))
, the outermost f_and could generate an object equally as efficient as f_and(a, b, c) ?The text was updated successfully, but these errors were encountered: