Giter Site home page Giter Site logo

mynameisfiber / high_performance_python Goto Github PK

View Code? Open in Web Editor NEW
733.0 45.0 282.0 17.37 MB

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

License: Other

Python 99.29% Makefile 0.33% C 0.11% Fortran 0.15% Shell 0.12%

high_performance_python's Issues

julia_lineprofiler no working

the example scripts for julia_lineprfiler do not work

thought this does not work in any python version
`
print "Length of x:", len(x)

print "Total elements:", len(zs)

`

@Profile decorator is not explained completely as once added the script can not be called with kernprof

Chapter 11: Page 373 Morris counters

The book states: "The maximum we could approximately count where we use a single unsigned byte
for the exponent is math.pow(2,255) == 5e76". The actual value is 5.79 x 10^76, so it should be rounded to 6. This might be intentional as the counters are approximate but I thought I'd bring it up!

chapter one questions and answers

1st, what are the elements of a computer architecture?

  • memory
  • computation unit
  • connections

2nd, what are some common alternate computer architectures?
(GPU)???

3rd, how does python abstract the underlying computer architecture?
Python have virtual machine, just like Java have a JVM

4th, what are some of the hurdles to make performant python code?

  • Python got a GIL
  • Python is a dynamic language
  • python's abstraction makes it difficult to do some L1/L2 cache thing

5th, what are different types of performance problems?
???

Chapter 4, pg 73

In the following sentence:
While we saw in the previous chapter that we are restricted to, at best, O(log n) lookup
time on lists/tuples with no intrinsic order (through a search operation), dictionaries
and sets give us O(n) lookups based on the arbitrary index.

Shouldn't the bold part part say: O(1) lookups?

Provided noop_profile_decorator does not work properly with line_profiler in Python 3

Hi,
The provided solution for "noop-profile" decorator does not work for Robert Kern's kernprof tool: it fails silently in reaching desired objective, as it prevents exceptions, but also prevent line_profiler from collecting information. It does work for memory_profiler module by Fabian Pedregosa and Philippe Gervais.

I use Python 3.5.2

A solution that works for both line_profiler and memory_profiler is:

# memory profile
try:
    @profile
    def dummy():
        pass
except NameError:
    def profile(func):
        def inner(*args, **kwargs):
            return func(*args, **kwargs)
        return inner

Am I missing something?

Update
Sorry, after reading again this part of the book, I see that two solutions are described, one for line_profiler and one for memory_profiler (the one in the repository that I linked above is the one for memory_profiler). But still, isn't it better to just catch NameError exceptions, rather than having two implementations?

Kind Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.