• Complain

Micha Gorelick - High Performance Python

Here you can read online Micha Gorelick - High Performance Python full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2015, publisher: O’Reilly, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Micha Gorelick High Performance Python

High Performance Python: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "High Performance Python" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Micha Gorelick: author's other books


Who wrote High Performance Python? Find out the surname, the name of the author of the book and a list of all author's works by series.

High Performance Python — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "High Performance Python" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
High Performance Python
Micha Gorelick
Ian Ozsvald
Preface

Python is easy to learn. Youre probably here because now that your code runscorrectly, you need it to run faster. You like the fact that your code is easyto modify and you can iterate with ideas quickly. The trade-off between easy todevelop and runs as quickly as I need is a well-understood and often-bemoanedphenomenon. There are solutions.

Some people have serial processes that have to run faster. Others have problemsthat could take advantage of multicore architectures, clusters, or graphics processing units. Someneed scalable systems that can process more or less as expediency and fundsallow, without losing reliability. Others will realize that their codingtechniques, often borrowed from other languages, perhaps arent as natural asexamples they see from others.

In this book we will cover all of these topics, giving practical guidance forunderstanding bottlenecks and producing faster and more scalable solutions.We also include some war stories from those who went ahead of you, who took theknocks so you dont have to.

Python is well suited for rapid development, production deployments, and scalablesystems. The ecosystem is full of people who are working to make it scale onyour behalf, leaving you more time to focus on the more challenging tasks aroundyou.

Who This Book Is For

Youve used Python for long enough to have an idea about why certain things areslow and to have seen technologies like Cython, numpy, and PyPy being discussedas possible solutions. You might also have programmed with other languages andso know that theres more than one way to solve a performance problem.

While this book is primarily aimed at people with CPU-bound problems, we alsolook at data transfer and memory-bound solutions. Typically these problems arefaced by scientists, engineers, quants, and academics.

We also look at problems that a web developer might face, including the movementof data and the use of just-in-time (JIT) compilers like PyPy for easy-win performancegains.

It might help if you have a background in C (or C++, or maybe Java), but it isnta pre-requisite. Pythons most common interpreter (CPythonthe standard younormally get if you type python at the command line) is written in C, and sothe hooks and libraries all expose the gory inner C machinery. There are lots ofother techniques that we cover that dont assume any knowledge of C.

You might also have a lower-level knowledge of the CPU, memory architecture, anddata buses, but again, thats not strictly necessary.

Who This Book Is Not For

This book is meant for intermediate to advanced Python programmers. Motivatednovice Python programmers may be able to follow along as well, but we recommendhaving a solid Python foundation.

We dont cover storage-system optimization. If you have a SQL or NoSQLbottleneck, then this book probably wont help you.

What Youll Learn

Your authors have been working with large volumes of data, a requirement for Iwant the answers faster! and a need for scalable architectures, for many yearsin both industry and academia. Well try to impart our hard-won experience tosave you from making the mistakes that weve made.

At the start of each chapter, well list questions that the following text shouldanswer (if it doesnt, tell us and well fix it in the next revision!).

We cover the following topics:

  • Background on the machinery of a computer so you know whats happening behind the scenes
  • Lists and tuplesthe subtle semantic and speed differences in these fundamental data structures
  • Dictionaries and setsmemory allocation strategies and access algorithms in these important data structures
  • Iteratorshow to write in a more Pythonic way and open the door to infinite data streams using iteration
  • Pure Python approacheshow to use Python and its modules effectively
  • Matrices with numpyhow to use the beloved numpy library like a beast
  • Compilation and just-in-time computingprocessing faster by compiling down to machine code, making sure youre guided by the results of profiling
  • Concurrencyways to move data efficiently
  • multiprocessingthe various ways to use the built-in multiprocessing library for parallel computing, efficiently share numpy matrices, and some costs and benefits of interprocess communication (IPC)
  • Cluster computingconvert your multiprocessing code to run on a local or remote cluster for both research and production systems
  • Using less RAMapproaches to solving large problems without buying a humungous computer
  • Lessons from the fieldlessons encoded in war stories from those who took the blows so you dont have to
Python 2.7

Python 2.7 is the dominant version of Python for scientific and engineeringcomputing. 64-bit is dominant in this field, along with *nix environments (oftenLinux or Mac). 64-bit lets you address larger amounts of RAM. *nix lets youbuild applications that can be deployed and configured in well-understood wayswith well-understood behaviors.

If youre a Windows user, then youll have to buckle up. Most of what we showwill work just fine, but some things are OS-specific, and youll have to research aWindows solution. The biggest difficulty a Windows user might face is theinstallation of modules: research in sites like StackOverflow should give youthe solutions you need. If youre on Windows, then having a virtual machine (e.g.,using VirtualBox) with a running Linux installation might help you to experimentmore freely.

Windows users should definitely look at a packaged solution like those available through Anaconda, Canopy, Python(x,y), or Sage. These same distributions will make the lives of Linux and Mac users far simpler too.

Moving to Python 3

Python 3 is the future of Python, and everyone is moving toward it. Python 2.7 will nonetheless be around for many years to come (some installations still use Python 2.4 from 2004); its retirement date has been set at 2020.

The shift to Python 3.3+ has caused enough headaches for library developers that people havebeen slow to port their code (with good reason), and therefore people have been slowto adopt Python 3. This is mainly due to the complexities of switching from a mix of string and Unicode datatypes in complicated applications to the Unicode and byte implementation in Python 3.

Typically, when you want reproducible results based on a set of trustedlibraries, you dont want to be at the bleeding edge. High performance Pythondevelopers are likely to be using and trusting Python 2.7 for years to come.

Most of the code in this book will run with little alteration for Python 3.3+(the most significant change will be with print turning from a statement intoa function). In a few places we specifically look at improvements that Python3.3+ provides. One item that might catch you out is the fact that / means integer division in Python 2.7, but it becomes float division in Python 3. Of coursebeing a good developer, your well-constructed unit test suite will already be testing your important code paths, so youll be alerted by your unit tests if this needs to be addressed in your code.

scipy and numpy have been Python 3compatible since late 2010. matplotlib was compatible from 2012, scikit-learn was compatible in 2013, and NLTK is expected to be compatible in 2014. Django has been compatible since 2013. The transition notes for each are available in their repositories and newsgroups; it is worth reviewing the processes they used if youre going to migrate older code to Python 3.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «High Performance Python»

Look at similar books to High Performance Python. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «High Performance Python»

Discussion, reviews of the book High Performance Python and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.