human
I am working on the file "18_01_26_optimizing_python/Speeding up python code.ipynb".
The first task is:
Example output:
~~~~
Timer unit: 1e-06 s
Total time: 0.060595 s
File: <ipython-input-20-d9bf5ccb538f>
Function: simple_sum_sq at line 1
Line #      Hits         Time  Per Hit   % Time  Line Contents
 1                                           def simple_sum_sq(size):
 2         1        821.0    821.0      1.4      image = np.random.random((size, size))
 3                                               
 4         1          1.0      1.0      0.0      sum_sq = 0
 5       201         95.0      0.5      0.2      for i in range(size):
 6     40200      16937.0      0.4     28.0          for j in range(size):
 7     40000      42741.0      1.1     70.5              sum_sq += image[i, j]**2

~~~~
That's a pretty nice overview of how long it takes to run a certain line and how often that line gets run. While the image = ... line takes the longest per-run, the sum_sq += ... line gets run way more, and ends up taking up ~70% of the runtime.
I show a more complex profiling example near the bottom of this notebook ("Real World Example")
2c) cProfile
This is great if you want to see which functions are slow, but don't care where they are located within your code.
This is good for a very complex project, with lots of nested functions.  This way you know that calculate_pressure is taking up a bunch of time, even though it's located at 20 locations in your code (and at each location it's not noticably slow).
(Note: I haven't used cProfile much, so I don't know too much about it...)
Can you write Python program for it?
 ... Give me a the Python program you requested?
assistant
#Here is the Python program you requested.

import cProfile

def create_mesh_grid(size):
    size=20000

    xs = range(size)
    ys = range(size)
    Y, X = np.meshgrid(xs, ys)

cProfile.run("create_mesh_grid(20000)")