Skip to content

Cache requests to /v2/components/<id>#59

Open
nikulin wants to merge 2 commits intosalmiakki:mainfrom
nikulin:cache-components
Open

Cache requests to /v2/components/<id>#59
nikulin wants to merge 2 commits intosalmiakki:mainfrom
nikulin:cache-components

Conversation

@nikulin
Copy link
Copy Markdown
Contributor

@nikulin nikulin commented Jun 20, 2022

Decrease script running time by 2 times.
Before changes

ncalls tottime percall cumtime percall filename:lineno(function)

455 0.006 0.000 22.967 0.050 connection.py:91(request)

455 0.003 0.000 22.246 0.049 connection.py:108(_request)

455 0.006 0.000 22.242 0.049 connection.py:132(_try_request)

447 0.008 0.000 21.186 0.047 connection.py:25(method)

After

ncalls tottime percall cumtime percall filename:lineno(function)

12 0.001 0.000 3.735 0.311 connection.py:91(request)

12 0.000 0.000 3.207 0.267 connection.py:108(_request)

12 0.000 0.000 3.207 0.267 connection.py:132(_try_request)

13 0.001 0.000 1.825 0.140 connection.py:307(connect)

4 0.000 0.000 1.383 0.346 connection.py:25(method)

@nikulin nikulin force-pushed the cache-components branch from 5e27b80 to 50a9c4b Compare June 22, 2022 09:29
Comment thread prpr/main.py Outdated
from prpr.table import DISPLAYED_TAIL_LENGTH, print_issue_table

COMPONENT_SUFFIXES = "component_suffixes"
_components_cache = {}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to avoid global state if possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed new version that used requests-cache. If it's ok, let me know and I'll remove the first commit.

@nikulin nikulin force-pushed the cache-components branch from 4b0b227 to 0ca7cf7 Compare June 29, 2022 08:14
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.

2 participants