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 columns loading: lazy create row locator #797

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Reskov
Copy link

@Reskov Reskov commented Oct 10, 2021

Locator instance builds unnecessary query for each row when the model is loaded from a database, to my mind, it is better to create an instance of the locator/UpdateRequest lazily (only if some values are passed to the model)

Here are the results of the benchmarks for loading 20000 rows, from my previous PR

#786 (comment)

before

CPU time: 0.55 s, Real time: 0.56 s

Single column loader
CPU time: 0.33 s, Real time: 0.33 s

Partial loader
CPU time: 0.45 s, Real time: 0.45 s

after

CPU time: 0.20 s, Real time: 0.20 s
Single column loader
CPU time: 0.04 s, Real time: 0.04 s
Partial loader
CPU time: 0.15 s, Real time: 0.15 s

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

1 participant