-
Notifications
You must be signed in to change notification settings - Fork 608
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
perf(common): remove recursion when flattening collections #8713
perf(common): remove recursion when flattening collections #8713
Conversation
e6c9c6a
to
c8f781c
Compare
I also tried this approach but actually got worse results. Did you run the benchmarks? A little bit more context here: in the majority of the cases there are either no sequence/mapping arguments or just a single one, so usually these recursions are 1-2 level deep. |
The benchmarks look nearly exactly the same to me in both cases:
Both approaches are an improvement, and I definitely prefer the iterative version for two reasons:
|
fc11b22
to
cd22d60
Compare
I compared the two directly (NOW is the recursive, the other is the iterative):
For the record, I'm in favor of the iterative approach as well. |
Definitely ready to concede this one. The level of recursion here appears to be something that is internal and controlled by Ibis, i.e., there's no obvious way that a user can construct arbitrarily deep sequences that flattened by this function and would thus potentially hit Python's recursion limit. |
Follow-up/alternative to #8709.