Jason Brownlee's Blog, page 14

October 10, 2023

Benchmark Python with timeit

You can benchmark snippets of Python code using the timeit module in the standard library. In this tutorial, you will discover how to benchmark Python code using the timeit module. Let’s get started. Need to Benchmark Python Code Benchmarking Python code refers to comparing the performance of one program to variations of the program. Benchmarking […]
 •  0 comments  •  flag
Share on Twitter
Published on October 10, 2023 11:00

October 8, 2023

Benchmark timeit Command Line Interface

You can benchmark snippets of Python code on the command line by using the timeit module. In this tutorial, you will discover how to use the timeit command line interface to benchmark code in Python. Let’s get started. What is timeit The timeit module is provided in the Python standard library. It provides an easy […]
 •  0 comments  •  flag
Share on Twitter
Published on October 08, 2023 11:00

October 5, 2023

Benchmark Python with timeit.timeit()

You can benchmark snippets of Python code using the timeit.timeit() function. In this tutorial, you will discover how to benchmark Python code using the timeit.timeit() function. Let’s get started. What is timeit The timeit module is provided in the Python standard library. It provides an easy way to benchmark single statements and snippets of Python […]
 •  0 comments  •  flag
Share on Twitter
Published on October 05, 2023 11:00

October 4, 2023

Concurrent NumPy 7-Day Course

NumPy can be so much faster with the careful use of concurrency. This includes built-in multithreaded algorithms via BLAS threads, the use of thread pools to execute NumPy functions in parallel, and efficient shared memory methods for sharing arrays between Python processes. This course provides you with a 7-day crash course in concurrency for NumPy. […]
 •  0 comments  •  flag
Share on Twitter
Published on October 04, 2023 11:00

October 3, 2023

How to Share a NumPy Array Via a Pipe

You can share NumPy arrays between processes using a multiprocessing Pipe. A Pipe is a data structure for inter-process communication that connects one process with another. In this tutorial, you will discover how to share NumPy arrays between processes using a Pipe. Let’s get started. What is a Multiprocessing Pipe In multiprocessing, a Pipe class […]
 •  0 comments  •  flag
Share on Twitter
Published on October 03, 2023 11:00

October 1, 2023

Python time.time() vs time.perf_counter()

You can use the time.time() function to access the system clock and the time.perf_counter() to benchmark Python code. The time.time() function should no longer be used for benchmarking because it is adjustable, non-monotonic, and lower resolution. Similarly, the time.perf_counter() function should not be used for ad hoc timings such as delays and timeouts because it […]
 •  0 comments  •  flag
Share on Twitter
Published on October 01, 2023 11:00

September 28, 2023

5 Ways to Measure Execution Time in Python

You can benchmark the execution of Python code using the “time” module in the standard library. In this tutorial, you will discover how to time the execution of Python code using a suite of different techniques. Let’s get started. Need to Time Python Code for Benchmarking Benchmarking Python code refers to comparing the performance of […]
 •  0 comments  •  flag
Share on Twitter
Published on September 28, 2023 12:00

September 26, 2023

Benchmark Python with time.thread_time()

You can benchmark Python code using the time.thread_time() function. In this tutorial, you will discover how to benchmark Python code using the time.thread_time() function. Let’s get started. Need to Benchmark Python Code Benchmarking Python code refers to comparing the performance of one program to variations of the program. Benchmarking is the practice of comparing business […]
 •  0 comments  •  flag
Share on Twitter
Published on September 26, 2023 12:00

September 25, 2023

Asyncio Coroutines Faster Than Threads!?

You can benchmark the performance of coroutines, threads, and processes on a suite of (simulated) common tasks. This is helpful to explore a refrain that “coroutines are faster than threads“, and the sometimes opposite refrain “threads are faster than coroutines“. Benchmark results across different common types of tasks show that both threads and coroutines are […]
 •  0 comments  •  flag
Share on Twitter
Published on September 25, 2023 12:00

September 24, 2023

Benchmark Python with time.process_time()

You can benchmark Python code using the time.process_time() function. In this tutorial, you will discover how to benchmark Python code using the time.process_time() function. Let’s get started. Need to Benchmark Python Code Benchmarking Python code refers to comparing the performance of one program to variations of the program. Benchmarking is the practice of comparing business […]
 •  0 comments  •  flag
Share on Twitter
Published on September 24, 2023 12:00