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

Optimize find_value_in_for_loop when no Value is found #865

Merged

Conversation

harrisonkaiser
Copy link
Contributor

@harrisonkaiser harrisonkaiser commented Oct 26, 2023

In the event that a for loop iterates over Values and also referes to elements not defined by the for loop, find_value_in_for_loop would needlessly call ForLoop::get_current_value for each of those lookups.

ForLoop::get_current_value can be expensive, potentially incurring a clone of a possibly large Value.

This change moves the get_current_value call so that we only clone a Value when needed.

In the event that a for loop iterates over `Value`s and also referes to
elements not defined by the for loop, `find_value_in_for_loop` would needlessly
call `ForLoop::get_current_value` for each of those lookups.

`ForLoop::get_current_value` can be expensive, potentially incurring a clone of
a possibly large `Value`.

This change moves the `get_current_value` so that we only clone a `Value` when
needed.
@Keats Keats merged commit 7f32cf9 into Keats:master May 27, 2024
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.

None yet

2 participants