Python Benchmarking: Measure The Execution Time Of Python Code With The time And timeit Modules (Python Concurrency By Example)
Lingua: inglese
Editore: Independently published, 2023
- Brossura
- Nuovo

Da: Ria Christie Collections, Uxbridge, Regno UnitoRia Christie Collections
Venditore AbeBooks dal 25 marzo 2015
Condizione: Nuovo
EUR 27,57
Quantità: Più di 20 disponibili
Aggiungi al carrelloDescrizione dell’articolo da parte del venditore
Codice articolo ria9798865481171_new
- Titolo
- Python Benchmarking: Measure The Execution Time Of Python Code With The time And timeit Modules (Python Concurrency By Example)
- Autore
- Brownlee, Jason
- Editore
- Independently published
- Anno di pubblicazione
- 2023
- Condizione
- New
- Rilegatura
- Brossura
- Lingua
- inglese
- ISBN 13
- 9798865481171
- Serie
- Libro 3 di 3: Python Concurrency By Example
Without benchmarking, we're working in the dark.
Python code can be slow.Benchmarking is a way of discovering exactly how long code takes to execute. Without benchmarking, we have no idea whether changes make code run faster or not.
You need to know:
- How to benchmark statements, functions, and programs using the time module.
- How to develop benchmarking helper functions, context managers, and decorators.
- How to benchmark snippets of code using the timeit module.
Benchmarking is required to develop fast Python code.
Python provides 5 built-in functions for reporting the current time. The problem is, that many developers use just one, the time() function, and are unaware of how inappropriate it is for benchmarking. Instead, we should be using the perf_counter() function.
Python also provides the timeit module with API and command line interface specifically designed for benchmarking. It encodes best practices such as repeated execution of target code and use of a high-precision timing function. Nevertheless, few developers use it because it is confusing. The trick is to adopt the "timeit" mindset.
Introducing: "Python Benchmarking". A new book designed to teach you how to bring modern benchmarking practices to your projects, super fast!
You will get fast-paced tutorials showing you how to benchmark your Python code, as well as some much-needed advice on advanced topics, such as:
- How to benchmark asyncio programs and coroutines.
- How to choose the precision and units of measure when reporting benchmark results.
- Why it is a good idea to repeat benchmark tests many times and report average results.
- How profiling is not benchmarking but can help in deciding what to optimize.
Each tutorial is carefully designed to teach one critical aspect of how to effectively benchmark Python code.
Table of Contents
- Tutorial 01: Introduction.
- Tutorial 02: Benchmarking Python.
- Tutorial 03: Benchmarking With time.time()
- Tutorial 04: Benchmarking With time.monotonic()
- Tutorial 05: Benchmarking With time.perf_counter()
- Tutorial 06: Benchmarking With time.thread_time()
- Tutorial 07: Benchmarking With time.process_time()
- Tutorial 08: Comparing time Module Functions
- Tutorial 09: Benchmark Metrics
- Tutorial 10: Benchmark Repetition
- Tutorial 11: Benchmark Reporting
- Tutorial 12: Benchmark Helper Function
- Tutorial 13: Benchmark Stopwatch Class
- Tutorial 14: Benchmark Context Manager
- Tutorial 15: Benchmark Function Decorator
- Tutorial 16: Gentle Introduction to Asyncio
- Tutorial 17: Benchmarking Asyncio With loop.time()
- Tutorial 18: Benchmark Helper Coroutine
- Tutorial 19: Benchmark Asynchronous Context Manager
- Tutorial 20: Benchmark Coroutine Decorator
- Tutorial 21: Benchmarking With The timeit Module
- Tutorial 22: Benchmarking With timeit.timeit()
- Tutorial 23: Benchmarking With The timeit Command Line
- Tutorial 24: Profile Python Code
- Tutorial 25: Benchmarking With The time Command
- Tutorial 26: Conclusions
Learn Python benchmarking correctly, step-by-step.
"Riassunto" può appartenere a un’altra edizione di questo titolo.
Ria Christie Collections
Uxbridge, Regno Unito
Venditore AbeBooks dal 25 marzo 2015
Tariffe di spedizione da Regno Unito a U.S.A.
| Articolo | Da 6 a 12 giorni lavorativi | Da 6 a 12 giorni lavorativi |
|---|---|---|
| Primo articolo | EUR 13,94 | EUR 13,94 |
Metodi di pagamento
Descrizione dello Store
Specializzazione
Educational books, Textbooks, Fiction, Non- fictionInformazioni sull’azienda del venditore
Ryefield Investments Limited
175 Pield Heath Road
Uxbridge, Regno Unito UB8 3NL
Condizioni di vendita
All Returns and Refund are as per Abebooks policies.
Diritto di recesso
Se sei un consumatore puoi recedere dal contratto in conformità con quanto segue. Per Consumatore si intende qualsiasi persona fisica che agisce per scopi estranei alla propria attività commerciale, imprenditoriale, artigianale o professionale.
Informazioni sul diritto di recesso
Diritto legale di recesso
Hai il diritto di recedere dal presente contratto entro 14 giorni senza fornire alcuna motivazione.
Il periodo di recesso scade dopo 14 giorni dal giorno in cui tu o una terza parte, diversa dal vettore e da te indicata, acquisisce il possesso fisico dell'ultimo bene o dell'ultimo lotto o pezzo.
Per esercitare il diritto di recesso, compila e invia elettronicamente una dichiarazione esplicita sul nostro sito Web, alla voce “I miei acquisti” nella sezione “Mio account”. Ti comunicheremo senza indugio una conferma di ricezione di tale recesso su un supporto durevole (ad es. via e-mail).
Per rispettare il termine di recesso, è sufficiente inviare la comunicazione relativa all'esercizio del diritto di recesso prima della scadenza del periodo di recesso stesso.
Effetti del recesso
In caso di recesso dal presente contratto, ti rimborseremo tutti i pagamenti ricevuti, compresi i costi di spedizione (ad eccezione dei costi supplementari derivanti dalla tua eventuale scelta di un tipo di spedizione diverso dal tipo meno costoso di consegna standard da noi offerto).
Potremo effettuare una detrazione dal rimborso per la perdita di valore dei beni forniti, qualora tale perdita sia il risultato di una manipolazione non necessaria da parte tua.
Eseguiremo il rimborso senza indebito ritardo e non oltre 14 giorni dal giorno in cui saremo informati della tua decisione di recedere dal presente contratto.
Il rimborso sarà effettuato utilizzando lo stesso mezzo di pagamento da te usato per la transazione iniziale, salvo che tu non abbia espressamente concordato altrimenti; in ogni caso, non dovrai sostenere alcun costo quale conseguenza di tale rimborso.
Possiamo trattenere il rimborso finché non avremo ricevuto i beni oppure finché non avrai fornito la prova di averli rispediti, a seconda di quale condizione si verifichi per prima.
Dovrai rispedire i beni o consegnarli a Ria Christie Collections, Uxbridge, United Kingdom, senza indebito ritardo e, in ogni caso, entro 14 giorni dal giorno in cui ci hai comunicato la tua volontà di recedere dal presente contratto. Il termine è rispettato se rispedisci i beni prima della scadenza del periodo di 14 giorni. I costi diretti della restituzione dei beni saranno a tuo carico. Sei responsabile solo della diminuzione del valore dei beni risultante da una manipolazione diversa da quella necessaria per stabilire la natura, le caratteristiche e il funzionamento dei beni stessi.
Eccezioni al diritto di recesso
Il diritto di recesso non si applica a:
- La fornitura di giornali, periodici o riviste ad eccezione dei contratti di abbonamento; e
- La fornitura di contenuto digitale non fornito su un supporto materiale (ad es. su un CD o DVD), se al momento dell'invio dell'ordine hai accettato l'inizio dell'esecuzione e hai riconosciuto che non avresti potuto recedere una volta iniziata l'esecuzione.
Condizioni di spedizione
Orders usually ship within 2 business days. If your book order is heavy or oversized, we may contact you to let you know extra shipping is required. Thank you!