-
-
Notifications
You must be signed in to change notification settings - Fork 29
Migrate from tic/toc timers and %time/%timeit to new Timer context manager and timeit function #391
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: mmcky <[email protected]>
tic
,tac
,toc
timers to new Timer context manager in the quantecon package
|
@copilot a new release of Can we please remove the fall back code as it is no longer needed. |
Co-authored-by: mmcky <[email protected]>
Removed the Timer fallback code from both Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot please remove the |
Co-authored-by: mmcky <[email protected]>
Removed Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: mmcky <[email protected]>
Found and converted all remaining instances of
All Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot we have now updated the quantecon library in Can we please now update the Note: For |
Co-authored-by: mmcky <[email protected]>
Successfully converted all
All patterns now use Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot is the Is it possible for me to update |
The
The current pattern The lambda pattern is actually quite readable in our current usage and is the Python best practice for this use case. |
This PR migrates all timing code in the lecture series from legacy timing patterns to the new quantecon package timing utilities in v0.9.0+ and v0.10.0.
Changes Made
Updated timing patterns across multiple lectures:
lectures/numba.md
: Migrated 6 instances of tic/toc usage to Timer context managerlectures/numpy.md
: Migrated 4 instances of tic/toc usage + 4 instances of %time/%%time to Timerlectures/parallelization.md
: Migrated 4 instances of %time/%%time to Timer + 3 instances of %timeit to qe.timeit()lectures/jax_intro.md
: Migrated 13 instances of %time/%%time to Timer context managerlectures/scipy.md
: Added quantecon import + migrated 2 instances of %timeit to qe.timeit()Migration patterns:
Key Implementation Details
silent=True
from Timer instances to display timing output alongside captured elapsed timesqe.timeit(lambda: expression(), runs=3)
pattern following Python best practices for timing callablesValidation
time1 / time3
still work correctly)The migration maintains full functionality while modernizing timing patterns to use the cleaner context manager and function-based approach with the official quantecon implementation.
Fixes #390.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.