Say, thousands of people using your
code everyday and if you save 1
second to run it, this means you
could save over 4 days of time
human race wasted per a year.
1Hz
L1 Cache Acces
L2 Cache Access
L3 Cache Access
RAM Access
SSD I/O
HDD I/O
Internet: Tokyo to SF
Run IPython (0.6s)
Reboot (5m)
3s
9s
43s
6m
2-6 days
1-12 months
12 years
63 years
32,000 years!!
Disassemble Python Code To
CPython Bytecode
To Support Analysis
dis module
https://docs.python.org/3/library/dis.html
https://github.com/python/cpython/blob/master/Include/opcode.h
line # of source
op addr / instruction annotations
param
line_profiler
• can profile line-by-line basis
• Uses a decorator to mark the
chosen function (@profile)
• introduces greater overhead
https://github.com/rkern/line_profiler
profiling
• Interactive Python profiler which
inspired from Unity3D Profiler
• Keep the call stack.
• Live Profiling
• Only Support Linux
https://github.com/what-studio/profiling
fibona
Korean Fried Chicken Served as one
chicken. (not pieces)
And it’s quite complex to determine
how many chicken would enough for
N people.
fibona
The problem can be solved easily
using fibonacci number.
1 1 2 3 5 8 13 21 34 …
For Nth fibonacci number of people,
N-1 th fibonacci number of chicken
would be perfect.
fibona
Awesome Idea! but how do you get
enough chicken if number of the
people is not an fibonacci number?
n is a Fibonacci number if and only if 5n*n+4 or
5n*n-4 is a square
Gessel s Formula
http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibFormula.html