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

Generator support in fromdicts requires large amount of memory #618

Closed
arturponinski opened this issue Apr 4, 2022 · 2 comments · Fixed by #626
Closed

Generator support in fromdicts requires large amount of memory #618

arturponinski opened this issue Apr 4, 2022 · 2 comments · Fixed by #626
Assignees
Labels
Bug It must work in all situations, but this failed Performance
Milestone

Comments

@arturponinski
Copy link
Collaborator

The PR: #569 which introduced generators support in fromdicts has increased memory usage on our production instances.

Problem description

Per itertools.tee docs:

This itertool may require significant auxiliary storage (depending on how much temporary data needs to be stored). In general, if one iterator uses most or all of the data before another iterator starts, it is faster to use list() instead of tee().

This most likely is the cause. Due to this, the generator support should:

  1. Be moved to a separate method, ie. fromdictsgenerator
  2. The method should use a temporary file, similarly to how SortView does
@arturponinski arturponinski self-assigned this Apr 4, 2022
@arturponinski arturponinski added Bug It must work in all situations, but this failed Performance labels Apr 4, 2022
@arturponinski arturponinski added this to the v1.7.9 milestone Apr 4, 2022
@arturponinski arturponinski modified the milestones: v1.7.9, v1.7.10, v1.7.11 Jun 16, 2022
@bmaggard
Copy link
Contributor

The problem description does not describe a "memory leak"
Perhaps something like "Generator support in fromdicts requires large amounts of memory" would be a more appropriate title?

@arturponinski arturponinski changed the title Generator support in fromdicts causes memory leaks Generator support in fromdicts requires large amount of memory Jul 13, 2022
@arturponinski
Copy link
Collaborator Author

Fair point, description updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It must work in all situations, but this failed Performance
Projects
None yet
2 participants