• Stars
    star
    733
  • Rank 61,389 (Top 2 %)
  • Language
    Python
  • License
    Other
  • Created about 10 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code for the book "High Performance Python" by Micha Gorelick and Ian Ozsvald with OReilly

High Performance Python: The Code

This repository contains the code from "High Performance Python" by Micha Gorelick and Ian Ozsvald with O'Reilly Media. Each directory contains the examples from the chapter in addition to other interesting code on the subject.

Topics Covered

This book ranges in topic from native Python to external modules to writing your own modules. Code is shown to run on one CPU, multiple coroutines, multiple CPU's and multiple computers. In addition, throughout this exploration a focus is kept on keeping development time fast and learning from profiling output in order to direct optimizations.

The following topics are covered in the code repo:

  • Chapter 1: Profiling

    • What are the ways to profile your code?
    • What insights can I gain from a profile?
  • Chapter 2: Understanding Performant Programming

    • How does a computer work and how does that affect my code performance?
  • Chapter 3: Lists and Tuples

    • How do lists and tuples work?
    • What are the performance implications of this?
  • Chapter 4: Dictionaries and Sets

    • How do dictionaries and sets work?
    • What are the performance implications of this?
  • Chapter 5: Iterators

    • How do iterators work?
    • How can I use them to reduce memory in my code?
    • How can I use them to reduce the CPU operations needed in my code?
  • Chapter 6: Matrix and Vector Computation

    • How does the CPU perform matrix/vector operations?
    • What are the ways I can profile the efficiency of these operations?
    • How can I speed up code given a profile?
  • Chapter 7: Compiling to C

    • What are the automated ways to compile my python to C?
    • What are the manual ways to compile my python to C?
    • How can I use these technologies to speed up my code and not slow down development?
  • Chapter 8: Concurrency

    • How does concurrency work and how does python support it?
    • How can I speed up multiple IO operations?
    • How can I hide IO wait?
  • Chapter 9: Multiprocessing

    • What is multiprocessing?
    • How can I speed up my code on a multiple CPU machine?
    • What are the subtleties of muli-CPU code?
  • Chapter 10: Clusters and Job Queues

    • How can I extend my code to a cluster?
    • What are some of the pain-points with clusters?
    • What is a queue and how is it useful?
  • Chapter 11: Using Less Ram

    • How can I use algorithms to reduce the RAM usage of my code?
    • What are tries and probabilistic data structures?
  • Chapter 12: Lessons from the Field (no code)

    • Some stories from the field on performance python

Using the code base

This code base is a live document and should be freely commented on and used. It is distributed with a license that amounts to: don't use the code for profit, however read the provided license file for the law-jargon. Feel free to share, fork and comment on the code!

If any errors are found, or you have a bone to pick with how we go about doing things, leave an issue on this repo! Just keep in mind that all code was written for educational purposes and sometimes this means favouring readability over "the right thing" (although in Python these two things are generally one and the same!).

More Repositories

1

high_performance_python_2e

Code for the book "High Performance Python 2e" by Micha Gorelick and Ian Ozsvald with OReilly
Python
406
star
2

pyxmeans

Quick implementation of xmeans in python and C
C
86
star
3

gohll

An implementation of HLL++ in go
Go
69
star
4

fuggetaboutit

implementations of a counting bloom, a timing bloom and a scaling timing bloom... made for working with streams!
Python
42
star
5

timescope

rolling shutter and other fun in opencv
Python
37
star
6

realtimestream

Slides for the realtime stream processing tutorial at data gotham
Python
30
star
7

pytailcall

Crazy Python bytecode hacking for great tail call optimizations
Python
29
star
8

countmemaybe

A set of distinct value estimators that give probabilistic bounds on a sets cardinality
Python
22
star
9

baton

distributed federated learning for pytorch
Python
15
star
10

Shell-Config

My various config files for a proper dev enviroment
Vim Script
12
star
11

gocountme

LevelDB backed KMin Values database for quick and easy set operations.
Go
12
star
12

skycolor

API to get the color of the sky
Python
9
star
13

nanogenmo2015

Python
8
star
14

mrboterson

Simple framework for building slack bots in python
Python
8
star
15

cider-go

cider-go is a redis cluster proxy... allows you to use a fault tolerant redis cluster with your standard redis client libraries!
Go
7
star
16

beacon_locate

Triangulate phone location with fixed-location ibeacons
Python
7
star
17

gun_registry

Sketch of a privacy ensuring gun registry
Python
6
star
18

seamresize

Resize images by extracting out image seams
Python
6
star
19

2017-qcon-deeplearning

My 2016 QCon talk about deep learning and keras
Jupyter Notebook
5
star
20

gitcheck

Checks repositories for updates and shows nice bubble notification on updates (using libnotify)
Python
4
star
21

pypad

Experimental python editor
Python
4
star
22

waveequation

Putting a simple wave equation finite difference solver into BoxLib AMR
Fortran
3
star
23

interestigizer

make images automatically more interesting!
JavaScript
3
star
24

mynameisfiber.github.com

HTML
3
star
25

poopybutthole

automagically swap faces in a target image with candidate faces from a database
Python
2
star
26

showsnearme

This repo provides a python module and CLI script to poll and display shows from a variety of sources
Python
2
star
27

pyword2vec

python niceties for working with word2vec
Python
2
star
28

pymicha

Snippets of code I find useful and want around
Python
2
star
29

jackslinks

Non-blocking linked lists with O(1) move and O(num_cursors) updates in Golang
Go
2
star
30

musicplayground

Just playing around with sklearn and echonest
Python
2
star
31

chuckie

A python module capable of of solving GR with BSSN through a fortran interface
Fortran
2
star
32

coalesce

Coalesce Blog
2
star
33

vithub

vim plugin to navigate github pull requests
Vim Script
1
star
34

auto3d

Python
1
star
35

litter-box

C++
1
star
36

lpocolypse

Looking at the impact of the L train shutdown on communities around the five boroughs
Python
1
star
37

nymarkable

NYTimes for your reMarkable
Python
1
star
38

amr

AMR using tessellations
C
1
star
39

bitcpy

Bitly Copy-Paste-y will automatically bitly-ify all links in your clipboard!
Python
1
star
40

WorldVis

Visualization of bitly's keyword stream
C++
1
star
41

effapp

Project moved to https://github.com/doombeard/effapp
Python
1
star
42

modem_stats

Optimum refused to acknowledge I had an internet issue... I begged to differ
Jupyter Notebook
1
star
43

somaliaborders

Create animation of Somali borders from wikipedia maps
Shell
1
star
44

pktsne

keras + tsne + (numpy|generators)
Python
1
star
45

thefreedomfoundation

Website for The Freedom Foundation
JavaScript
1
star
46

pregnantpause

Extent the length of silence inside an audiotrack to help with transcribing
Python
1
star
47

bitlydataapi

bitly data API examples... see http://dev.bitly.com/data_apis.html for more information
Python
1
star
48

Outflow-Driven-Turbulence

Code for my undergrad thesis
Fortran
1
star
49

euler-problems

Solutions to euler project problems
Python
1
star
50

tennessee_plants

Organized data from the Tennessee Valley Authority about indigenous plants
JavaScript
1
star
51

Misc-Old-Projects

Just a small collection of my mini-projects from the past years (mostly my undergrad years). I may update the euler/primes/number section or maybe add little readme's, but that's about it!
C
1
star