Exectiming

Latest version: v2.0.1

Safety actively analyzes 682416 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

2.0.0rc3

This project was originally titled PyTimer, but recent changes have lead to it being renamed. The module has completely been re-written from the ground up to be more consistent and powerful. Some of the brand new features include:
1. Best-fit-curve determination
2. More advanced output features like being able to transform logged function parameters
3. The ability to graph measured times against logged parameters and to graph the best-fit-curve

0.5.1

Updates have been made to how decorators are handled. Previously `PyTimer.setup_decorator()` was needed to adjust the `reps` or `runs_per_reps`. This has now been changed, and those values are defined when the function is decorated. This means that functions can have varying values for `reps` and `runs_per_reps`. Also, `callable_args` can also be added to the decorator definition.

PyTimer.decorator(reps=1, runs_per_reps=1, callable_args=False)
def func(arg):
pass

0.5

* Updated how keyword arguments are handled
* Cleaned up documentation
* Allowed argument for `time( )` and `time_it( )` to be to be callable. Meaning that everytime the function is called, the parameter values are updated. Allow for something like passing in random data for every run of a function.
* Changed naming scheme from reps and iterations to reps and runs_per_rep to make it clearer what each one is. Basic format is

for rep in range(reps):
for run in range(runs_per_rep):
...

* Elapsed times can be displayed or returned by consecutive calls to `elapsed( )`, which is static
* Renamed `evaluate( )` to `time( )` and added a static version of it called `time_it( )`

There have been several things renamed, so make sure to check through the API in the wiki.

0.4

Some new features:
- Introduced more time units: microseconds (us), and nanoseconds (ns)
- Switched from `time.time()` to `time.perf_counter()` which is more accurate and allows accuracy into nanosecond range
- Can force units to all be the same in displayed data: `PyTimer(units=(PyTimer.seconds, PyTimer.milliseconds, PyTimer.microseconds, PyTimer.nanoseconds))`
- standardized outputs between display methods
- added keyword argument support for functions using decorators, as well as `evaluate()` with a function
- added support for automatic message generation for splits generated by `evaluate()` and a function using the decorator
- `evaluate()` with a function is now more efficient by directly calling the function instead of using `exec()`

I also am working on the Wiki to be clearer and easier to find examples.

0.3.1

There have been a lot of changes for this version, a short list of which are:
- Timer can be set not to run when created, meaning it can be turned off easily and the timing code does not have to be removed.
- `evaluate` now supports `reps` and `iterations`
- `decorator` now supports `reps` and `iterations`
- `decorator` can have attributes passed in and return values now when used on a function
- `start` is required again to make sure results are required, however it is set to automatically happend upon object creation unless told not to
- all displayed output can be collected and then saved to a file
- standardized output between different `display_` functions

The API has changed some, so make sure to take a look to take a look at the wiki and examples.

0.2

New Features:
- Calculating single run of function using decorator `timer_var.decorator`
- Calculating multiple runs of function using `.evaluate(function, iterations=)`
- Calculating multiple runs of a string of code `.evaluate(string, iterations=)`
- Standard Deviation
- Averages across split

Most of the code has been rewritten as well to follow PEP standards and be better documented.

Page 1 of 2

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.