The perftester package enables you to run performance tests of Python functions/callables. Performance is understood in terms of both execution time and memory usage. In addition, perftester enables you to run benchmarks, an important functionality when you need to set limits for your tests.
You have time_test(), time_benchmark(), memory_usage_test() and memory_usage_benchmark() functions. In addition, the package offers a pp() function, for pretty printing of the benchmarking results. Time benchmarking and testing is based on timeit.repeat() function while memory benchmarking and testing is based on memory_profiler.memory_usage() function. The idea behind the package is to offer performance testing using a simple API, so the functions' APIs are simple and intuitive. You can run performance testing using perftester in two ways: * by adding perftester functions to your pytests (or doctests); it's a simple approach but makes units tests run much longer and the unit tests are mixed up with performance tests * by running perftester as a separate testing framework, using a command-line interface; even if not that simple, this approach is still quite simple, as you gather performance tests in dedicated files (starting off with "perftester_" prefix (so, "perftester*.py") In the latter case, you can also change the default settings in a dedicated Python module. You can change settings also in other ways, using a config object. But often, you do not need to do that, as you can do most of what you need using the above function's APIs. While perftester is lightweight, at the same time it offers various functionalities. Hence, especially when deciding to use it as a testing framework (and not part of pytests), one should spend some time on reading the documentation. You will find it in the GitHub repository: https://github.com/nyggus/perftester. You can install perftester from PyPi (https://pypi.org/project/perftester/): $ python -m pip install perftester While there are various ways to benchmark and profile Python code, perftester is, as far as I know, the first Python framework for performance testing (not just benchmarking) of Python functions. If you know such a tool, however, please let me know. If you like perftester, please consider leaving a star in the repository. So, happy perftesting! Marcin _______________________________________________ Python-announce-list mailing list -- email@example.com To unsubscribe send an email to python-announce-list-le...@python.org https://mail.python.org/mailman3/lists/python-announce-list.python.org/ Member address: arch...@mail-archive.com