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

Result micro optimizations #64

Closed
acostapazo opened this issue Jun 20, 2023 · 1 comment · Fixed by #65
Closed

Result micro optimizations #64

acostapazo opened this issue Jun 20, 2023 · 1 comment · Fixed by #65
Assignees

Comments

@acostapazo
Copy link
Contributor

With the help of cProfile, we can review possible optimizations.

Example

python -m cProfile -o benchmark.prof benchmark/time_result.py
snakeviz benchmark.prof
Screenshot 2023-06-20 at 23 20 35

These micro-improvements will probably not be noticed in most use cases, but it improves the library and helps to understand and improve the library profiling.

@acostapazo acostapazo self-assigned this Jun 20, 2023
@acostapazo
Copy link
Contributor Author

Current version

(venv) ➜  meiga git:(main) ✗ python benchmark/time_result.py
time when success: 591.8169169453904 ns
time when failure (no such key): 616.6854579932988 ns
time when failure (type missmatch): 653.6420419579372 ns

With result constructor optimization

(venv) ➜  meiga git:(main) ✗ python benchmark/time_result.py
time when success: 484.73962501157075 ns
time when failure (no such key): 684.1207499383017 ns
time when failure (type missmatch): 593.2172500761226 ns

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 a pull request may close this issue.

1 participant