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

Cache get_pre_loads results #140

Merged
merged 3 commits into from
Dec 11, 2023
Merged

Cache get_pre_loads results #140

merged 3 commits into from
Dec 11, 2023

Conversation

Pliner
Copy link
Contributor

@Pliner Pliner commented Dec 11, 2023

PR adds some caching for get_pre_loads. As illustrated further by benchmarks/transaction_load_dump.py example, time needed is reduced from 0.306 seconds to 0.178 seconds (42% decrease).

w/o cache:

696392 function calls (693320 primitive calls) in 0.306 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     2048    0.056    0.000    0.102    0.000 inspect.py:550(_getmembers)
   2050/2    0.019    0.000    0.140    0.070 schema.py:575(_deserialize)
     2048    0.017    0.000    0.126    0.000 hooks.py:15(get_pre_loads)
    10240    0.012    0.000    0.088    0.000 fields.py:342(deserialize)
     2048    0.009    0.000    0.009    0.000 {built-in method builtins.dir}
     2048    0.009    0.000    0.025    0.000 utils.py:145(from_iso_datetime)

with cache:

313416 function calls (310344 primitive calls) in 0.178 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   2050/2    0.019    0.000    0.139    0.069 schema.py:575(_deserialize)
    10240    0.012    0.000    0.087    0.000 fields.py:342(deserialize)
     2048    0.009    0.000    0.025    0.000 utils.py:145(from_iso_datetime)
     6144    0.007    0.000    0.010    0.000 fields.py:1091(_format_num)
     8192    0.006    0.000    0.016    0.000 fields.py:263(_validate)

@Pliner Pliner requested a review from a team as a code owner December 11, 2023 01:44
@Pliner Pliner force-pushed the cache-get-pre-loads branch 2 times, most recently from bffc8de to 0ff5793 Compare December 11, 2023 04:10
@Pliner Pliner force-pushed the cache-get-pre-loads branch from 0ff5793 to 9a17729 Compare December 11, 2023 04:11
@Pliner Pliner enabled auto-merge (squash) December 11, 2023 09:01
@Pliner Pliner merged commit 654fdcf into main Dec 11, 2023
10 checks passed
@Pliner Pliner deleted the cache-get-pre-loads branch December 11, 2023 09:04
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.

3 participants