Skip to content

feat: optimize passing data thru formatters #3699

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BobTheBuidler
Copy link
Contributor

@BobTheBuidler BobTheBuidler commented May 16, 2025

What was wrong?

In the current code, data_tree_map is called multiple times in rapid succession. This occurs for every call that is formatted.

data_tree_map creates and populates a new list each time its called, which is quite wasteful and not necessary for our use case, especially when we're calling it recursively

This PR changes the codebase so, instead of creating and populating a new list object at each and every stage of formatting, now we pass map objects thru the formatters and only create and populate one list when the formatting is complete.

The only api that changed was in an internal module, and the codebase was adapted accordingly. This small change makes a much bigger difference than the past few PRs did, so I'm hoping this API change doesn't block us from merging.

@kclowes you can use the same benchmark script you used for the last PR, you will see a tangible difference on that benchmark and you should also in the overall testing times

Related to Issue #
Closes #

How was it fixed?

Todo:

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@BobTheBuidler BobTheBuidler force-pushed the iterator-proxy branch 2 times, most recently from 99353e9 to 1bb3de3 Compare May 16, 2025 18:54
@BobTheBuidler BobTheBuidler marked this pull request as ready for review May 16, 2025 19:14
@BobTheBuidler BobTheBuidler changed the title feat: IteratorProxy helper class for passing data thru formatters feat: optimize passing data thru formatters May 16, 2025
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.

1 participant