下载  >  开发技术  >  Python  > High Performance Python.pdf

High Performance Python.pdf 评分:

High Performance Python.pdf
High Performance Python Micha gorelick and lan ozsvald Beijing· Cambridge.mham·Kh· Sebastopol. TokyoOREILLY High Performance Python by Micha gorelick and lan Ozsvald Copyright@ 2014 Micha Gorelick and Ian Ozsvald. All rights reserved Printed in the United States of america Published by o reilly media, InC., 1005 Gravenstein Highway North, Sebastopol, CA 95472 OReilly books may be purchased for educational, business, or sales promotional use. Online editions are alsoavailableformosttitles(http://safaribooksonline.com/).Formoreinformationcontactourcorporate institutionalsalesdepartment800-998-9938orcorporate@oreilly.com Editors: Meghan Blanchette and Rachel Roumeliotis Indexer: Wendy Catalano Production editor: matthew hacker Cover Designer: Karen Montgomery Copyeditor: Rachel Head Interior Designer: David Futato Proofreader: Rachel Monaghan strator: Rebecca demarest September 2014: First Edition Revision History for the First Edition: 2014-08-21: First release Seehttp://oreilly.com/catalog/errata.csp?isbn=9781449361594forreleasedetails Nutshell Handbook, the Nutshell Handbook logo, and the O Reilly logo are registered trademarks ofO Reilly Media, Inc. High Performance Python, the image of a fer-de-lance, and related trade dress are trademarks of O Reilly Media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O Reilly Media, Inc was aware ofa trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility forerrors or omissions, or for damages resulting from the use of the information contained herein ISBN:978-1-449-361594 Table of contents Preface 1. Understanding Performant Python. The Fundamental Computer System Computing units Memory Units x11257 Communications layers Putting the Fundamental Elements Together Idealized Computing Versus the Python Virtual Machine 10 So why use Python? 13 2. Profiling to Find Bottlenecks Profiling Efficiently 18 Introducing the Julia Set 19 Calculating the Full Julia Set 23 Simple approaches to Timing-print and a Decorator 26 Simple Timing Using the Unix time Command 29 USing the pRofile Mo ovule 31 Using runsnakerun to Visualize cProfile output 36 USing line_profiler for Line-by-Line Measurements 37 Using memory_profiler to Diagnose Memory Usage 42 Inspecting Objects on the Heap with heapy 48 USing dowser for Live Graphing of Instantiated Variables 50 Using the dis Module to Examine CPython Bytecode 52 Different Approaches, Different Complexity 54 Unit Testing During Optimization to Maintain Correctness 56 No-op @profile Decorator 5 Strategies to Profile Your Code Successfully 5 790 p-up 3. Lists and Tuples............ A More Efficient Lists Versus tuples Lists as dynamic arrays 67 Tuples as static arrays p-Up 4. Dictionaries and sets How Do Dictionaries and sets Work? Inserting and Retrieving Deletion 80 Resizing 81 Hash Functions and Entropy 81 Dictionaries and Namespaces p-up 88 5. Iterators and generators Iterators for infinite series 92 Lazy generator Evaluation 94 Wrap-U Pp P 98 6. Matrix and Vector Computation 99 Introduction to the problem 100 Arent Python Lists Good Enough 105 Problems with Allocating Too Much 106 Memory Fragmentation 109 Understanding per rf Making Decisions with perf's Output 113 Enter numpy 114 Applying numpy to the Diffusion Problem Memory Allocations and In-Place Operations 120 Selective Optimizations: Finding what Needs to be Fixed 124 numexpr: Making In-Place Operations Faster and Easier 127 A Cautionary Tale: Verify Optimizations(scipy) 129 Wrap-Up 7.〔 compiling to〔 135 What Sort of Speed Gains Are Possible? 136 JIT VersuS AOT Compilers 138 Why Does Type Information Help the Code Run Faster? 138 Using a C Compiler 139 Reviewing the Julia Set Example 140 Cython 140 Table of contents Compiling a pure-Python version using cython 141 Cython annotations to analyze a block of code 143 Adding Some Type Annotations 145 Shed skin 150 Building an Extension Module 151 The Cost of the Memory Copies 153 Cython and numpy 154 Parallelizing the Solution with OpenMP on One Machine 155 Numba 157 Pythran 159 Garbage Collection Differences 161 Running pypy and installing modules 162 When to Use Each Technology 163 Other Upcoming Projects 165 A Note on graphics Processing Units(GPUs 165 A Wish for a Future Compiler project 166 Foreign Function Interfaces 166 ctypes 167 ffi 170 fry CPython module 175 Wrap-Up 179 8.〔 concurrency.. 181 Introduction to Asynchronous Programming 182 Serial crawler 185 gevent 187 tornado 192 asyncH 196 Database Example 198 Wrap-Up 201 9. The multiprocessing module 203 An Overview of the Multiprocessing Module 206 Estimating Pi USing the Monte Carlo M 208 Estimating Pi Using Processes and Threads 209 Using Python Objects 210 Random Numbers in Parallel Systems 217 Using numpy 218 Finding Prime Numbers 221 Queues of Work 227 Verifying Primes Using Interprocess Communication 232 Table of content Serial solution 236 Naive pool solution A Less naive pool solution 238 USing Manager. Value as a Flag 239 Using Redis as a Flag 241 Using raw value as a Flag 243 Using mmap as a flas 244 USing mmap as a Flag Redux 245 Sharing numpy Data with multiprocessing 248 Synchronizing file and Variable access 254 File locking 254 Locking a value 258 Wrap-Up 261 10. Clusters and Job Queues. 263 Benefits of Clustering 264 Drawbacks of Clustering 265 $462 Million Wall Street Loss Through Poor Cluster Upgrade Strategy 266 Skype s 24-Hour Global Outage 267 Common Cluster Designs 268 How to Start a Clustered Solution 268 Ways to Avoid Pain When Using Clusters 269 Three Clustering Solutions 270 Using the Parallel Python Module for Simple local clusters 271 Using IPython Parallel to Support Research 272 NSQ for Robust Production Clustering 277 Queues 277 Pub/sub 278 Distributed Prime calculation 280 Other Clustering Tools to Look at 284 Wrap-Up 284 11. Using Less ram 287 Objects for Primitives Are Expensive 288 The Array Module Stores Many Primitive Objects Cheaply 289 Understanding the ram used in a collection 292 Bytes versus Unicode 294 Efficiently Storing Lots of Text in RAM 295 Trying These Approaches on 8 Million Tokens 296 Tips for Using Less ram 304 Probabilistic Data structures 305 Very approximate Counting with a 1-byte Morris Counter 306 K-Minimum values 308 vi Table of Contents Bloom filters 312 LogLog Counter 317 Real-World example 321 12. Lessons from the field......4.4.4...4... 325 Adaptive Labs Social Media AnalytiCs(SOMA) 325 Python at Adaptive lab 326 SOMAS Design 326 Our Development Methodology 327 Maintaining SoMA 327 Advice for Fellow Engineers 328 MakingDeepLearningFlywithRadimrehurek.com 328 The Sweet Spot 328 Lessons in Optimizing 330 Wrap-U P 332 Large-scaleProductionizedMachineLearningatLyst.com 333 Pythons place at lyst 333 Cluster Design 333 Code evolution in a Fast-Moving Start-Up 333 Building the recommendation Engine 334 Reporting and Monitoring 334 Some advice 335 Large-Scale Social Media Analysis at Smesh 335 Pythons role at Smesh 335 The platform 336 High Performance Real-Time String Matching 336 Reporting, Monitoring, Debugging, and Deployment 338 PyPy for Successful Web and Data Processing Systems 339 Prerequisites 339 The database 340 The Web Application 340 OCR and Translation 341 Task Distribution and workers 341 Conclusion 341 TaskqUEuesatLanyrd.com 342 Pythons role at lanyrd 342 Making the Task Queue Performant 343 Reporting, Monitoring, Debugging, and Deployment 343 Advice to a Fellow Developer 343 Index 345 Table of Contents

...展开详情
2017-08-28 上传 大小:8.67MB
举报 收藏 (1)
分享

评论 下载该资源后可以进行评论 共1条

walsripe 挺好的资源哦
2017-10-04
回复
High Performance Django 2015.3

Getting started with Django is easy. There are tutorials and books that literally walk you through the process of getting your first site up and running. Taking that code from your laptop to the real world is like opening pandora’s box.

立即下载
C++ High Performance

C++ High Performance Viktor Sehr, Björn Andrist January 2018 Book Description C++ is a highly portable language and can be used to write complex applications and performance-critical code. It has evolved over the last few years to become a modern and expressive language. This book will guide you th

立即下载
C++_High_Performance_english_2018.pdf

Write code that scales across CPU registers, multi-core, and machine clusters Key Features Explore concurrent programming in C++ Identify memory management problems Use SIMD and STL containers for performance improvement Book Description C++ is a highly portable language and can be used to write com

立即下载
Python High Performance(2nd) 无水印pdf

Python High Performance(2nd) 英文无水印pdf 第2版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

立即下载
High Performance Python Python高性能编程.pdf 中文版

本书共有12章,围绕如何进行代码优化和加快实际应用的运行速度进行详细讲解。本书主要包含以下主题:计算机内部结构的背景知识、列表和元组、字典和集合、迭代器和生成器、矩阵和矢量计算、并发、集群和工作队列等。最后,通过一系列真实案例展现了在应用场景中需要注意的问题。 本书适合初级和中级Python程序员、有一定Python语言基础想要得到进阶和提高的读者阅读。

立即下载
High Performance Python - EN

High Performance Python High Performance Python High Performance Python

立即下载
Python High Performance(第二版带目录)

Python High Performance(第二版带书签很清晰英文无水印)

立即下载
High Performance Python

Chapter 1. Introduction, Section 1.1. The High Performance Buzz-word, Chapter 2. The Theory of Computation, Section 2.1. Introduction, Section 2.2. Problems, Section 2.3. Models of Computation, Chapter 3. Algorithms, Section 3.1. Introduction, Section 3.2. Anatomy of an Algorithm, Section 3.3. Intro

立即下载
High Performance Python 原版PDF by Gorelick & Ozsvald

Python is easy to learn. You’re probably here because now that your code runs correctly, you need it to run faster. You like the fact that your code is easy to modify and you can iterate with ideas quickly. The trade-off between easy to develop and runs as quickly as I need is a well-understood and

立即下载
Python高性能编程(High Performance Python 中文版) 高清版本

Python 语言是一种脚本语言,其应用领域非常广泛,包括数据分析、自然语言处理、 机器学习、科学计算、推荐系统构建等。 本书共有 12 章,围绕如何进行代码优化和加快实际应用的运行速度进行详细讲解。本 书主要包含以下主题:计算机内部结构的背景知识、列表和元组、字典和集合、迭代 器和生成器、矩阵和矢量计算、并发、集群和工作队列等。最后,通过一系列真实案 例展现了在应用场景中需要注意的问题。

立即下载
PYTHON_HIGH_PERFORMANCE_SECOND_EDITION

The Python programming language has seen a huge surge in popularity in recent years, thanks to its intuitive, fun syntax, and its vast array of top-quality third-party libraries. Python has been the language of choice for many introductory and advanced university courses as well as for numerically i

立即下载
C++ High Performance Boost and optimize the performance of your C++17 code epub

C++ High Performance Boost and optimize the performance of your C++17 code 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书

立即下载
C++ High Performance Boost and optimize the performance of your C++17 zip

C++ High Performance Boost and optimize the performance of your C++17 code_Code 源码 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书

立即下载
C++ High Performance Boost and optimize the performance of your C++17 code.

C++ High Performance Boost and optimize the performance of your C++17 code. pdf 版的

立即下载
High Performance Python 无水印pdf

High Performance Python 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

立即下载
High performance python

Chapter 1. Introduction, Section 1.1. The High Performance Buzz-word, Chapter 2. The Theory of Computation, Section 2.1. Introduction, Section 2.2. Problems, Section 2.3. Models of Computation, Chapter 3. Algorithms, Section 3.1. Introduction, Section 3.2. Anatomy of an Algorithm, Section 3.3. Intro

立即下载