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 SSL context in client.py #281

Merged
merged 1 commit into from
Feb 2, 2024
Merged

Conversation

evgkirov
Copy link
Collaborator

@evgkirov evgkirov commented Feb 1, 2024

Description

Related issue: #279

Simple benchmark

# init_1000_times.py
from pyuploadcare import Uploadcare
for i in range(1000):
    Uploadcare(public_key="demopublickey", secret_key="demoprivatekey")

Before:

❯ hyperfine -N "poetry run python init_1000_times.py" --warmup=5
Benchmark 1: poetry run python init_1000_times.py
  Time (mean ± σ):      9.369 s ±  0.046 s    [User: 8.916 s, System: 0.285 s]
  Range (min … max):    9.322 s …  9.460 s    10 runs


~/Projects/pyuploadcare bugfix/279-cache-ssl-context* ≡ 2m 20s

After:

❯ hyperfine -N "poetry run python init_1000_times.py" --warmup=5
Benchmark 1: poetry run python init_1000_times.py
  Time (mean ± σ):     594.3 ms ±   4.0 ms    [User: 446.7 ms, System: 64.7 ms]
  Range (min … max):   588.6 ms … 600.6 ms    10 runs


~/Projects/pyuploadcare bugfix/279-cache-ssl-context* ≡ 9s

Checklist

@evgkirov
Copy link
Collaborator Author

evgkirov commented Feb 1, 2024

Failing integration tests are not related to this change.

@evgkirov evgkirov force-pushed the bugfix/279-cache-ssl-context branch from 7090606 to a6bfe1d Compare February 2, 2024 10:00
@evgkirov evgkirov merged commit 91aac73 into main Feb 2, 2024
33 checks passed
@evgkirov evgkirov deleted the bugfix/279-cache-ssl-context branch April 9, 2024 12:28
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