mynameisfiber / high_performance_python Goto Github PK
View Code? Open in Web Editor NEWCode for the book "High Performance Python" by Micha Gorelick and Ian Ozsvald with OReilly
License: Other
Code for the book "High Performance Python" by Micha Gorelick and Ian Ozsvald with OReilly
License: Other
There are 2 issues:
func_name
attribute;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
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!
1st, what are the elements of a computer architecture?
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?
5th, what are different types of performance problems?
???
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?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.