Mastering Python High Performance

Learn how to optimize your code and Python performance with this vital guide to Python performance profiling and benchmarking
Preview in Mapt

Mastering Python High Performance

Fernando Doglio

2 customer reviews
Learn how to optimize your code and Python performance with this vital guide to Python performance profiling and benchmarking
Mapt Subscription
FREE
$29.99/m after trial
eBook
$22.40
RRP $31.99
Save 29%
Print + eBook
$39.99
RRP $39.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$22.40
$39.99
$29.99 p/m after trial
RRP $31.99
RRP $39.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Mastering Python High Performance Book Cover
Mastering Python High Performance
$ 31.99
$ 22.40
Modern Python Cookbook Book Cover
Modern Python Cookbook
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $36.98
Add to Cart

Book Details

ISBN 139781783989300
Paperback260 pages

Book Description

Simply knowing how to code is not enough; on mission-critical pieces of code, every bit of memory and every CPU cycle counts, and knowing how to squish every bit of processing power out of your code is a crucial and sought-after skill. Nowadays, Python is used for many scientific projects, and sometimes the calculations done in those projects require some serious fine-tuning. Profilers are tools designed to help you measure the performance of your code and help you during the optimization process, so knowing how to use them and read their output is very handy.

This book starts from the basics and progressively moves on to more advanced topics. You’ll learn everything from profiling all the way up to writing a real-life application and applying a full set of tools designed to improve it in different ways. In the middle, you’ll stop to learn about the major profilers used in Python and about some graphic tools to help you make sense of their output. You’ll then move from generic optimization techniques onto Python-specific ones, going over the main constructs of the language that will help you improve your speed without much of a change. Finally, the book covers some number-crunching-specific libraries and how to use them properly to get the best speed out of them.

After reading this book, you will know how to take any Python code, profile it, find out where the bottlenecks are, and apply different techniques to remove them.

Table of Contents

Chapter 1: Profiling 101
What is profiling?
The importance of profiling
What can we profile?
Memory consumption and memory leaks
The risk of premature optimization
Running time complexity
Profiling best practices
Summary
Chapter 2: The Profilers
Getting to know our new best friends: the profilers
line_profiler
Summary
Chapter 3: Going Visual – GUIs to Help Understand Profiler Output
KCacheGrind – pyprof2calltree
RunSnakeRun
Summary
Chapter 4: Optimize Everything
Memoization / lookup tables
Usage of default arguments
List comprehension and generators
ctypes
String concatenation
Other tips and tricks
Summary
Chapter 5: Multithreading versus Multiprocessing
Parallelism versus concurrency
Summary
Chapter 6: Generic Optimization Options
PyPy
Cython
How to choose the right option
Summary
Chapter 7: Lightning Fast Number Crunching with Numba, Parakeet, and pandas
Numba
The pandas tool
Parakeet
Summary
Chapter 8: Putting It All into Practice
The problem to solve
The initial code base
Summary

What You Will Learn

  • Master code optimization step-by-step and learn how to use different tools
  • Understand what a profiler is and how to read its output
  • Interpret visual output from profiling tools and improve the performance of your script
  • Use Cython to create fast applications using Python and C
  • Take advantage of PyPy to improve performance of Python code
  • Optimize number-crunching code with NumPy, Numba, Parakeet, and Pandas

Authors

Table of Contents

Chapter 1: Profiling 101
What is profiling?
The importance of profiling
What can we profile?
Memory consumption and memory leaks
The risk of premature optimization
Running time complexity
Profiling best practices
Summary
Chapter 2: The Profilers
Getting to know our new best friends: the profilers
line_profiler
Summary
Chapter 3: Going Visual – GUIs to Help Understand Profiler Output
KCacheGrind – pyprof2calltree
RunSnakeRun
Summary
Chapter 4: Optimize Everything
Memoization / lookup tables
Usage of default arguments
List comprehension and generators
ctypes
String concatenation
Other tips and tricks
Summary
Chapter 5: Multithreading versus Multiprocessing
Parallelism versus concurrency
Summary
Chapter 6: Generic Optimization Options
PyPy
Cython
How to choose the right option
Summary
Chapter 7: Lightning Fast Number Crunching with Numba, Parakeet, and pandas
Numba
The pandas tool
Parakeet
Summary
Chapter 8: Putting It All into Practice
The problem to solve
The initial code base
Summary

Book Details

ISBN 139781783989300
Paperback260 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Modern Python Cookbook Book Cover
Modern Python Cookbook
$ 39.99
$ 28.00
Python High Performance - Second Edition Book Cover
Python High Performance - Second Edition
$ 31.99
$ 22.40
Python Parallel Programming Cookbook Book Cover
Python Parallel Programming Cookbook
$ 39.99
$ 28.00
Mastering Python Design Patterns Book Cover
Mastering Python Design Patterns
$ 26.99
$ 18.90
Python 3 Object-oriented Programming - Second Edition Book Cover
Python 3 Object-oriented Programming - Second Edition
$ 39.99
$ 28.00
Software Architecture with Python Book Cover
Software Architecture with Python
$ 39.99
$ 10.00