Commit 3ddd89a7 authored by Stefan Behnel's avatar Stefan Behnel

Suggest in Jupyter magic help page that PGO profile executions should be repeated.

parent 5bdfbcb5
...@@ -268,14 +268,16 @@ class CythonMagics(Magics): ...@@ -268,14 +268,16 @@ class CythonMagics(Magics):
for item in data: for item in data:
... ...
from somewhere import typical_data # execute function several times to build profile
critical_function(typical_data) # execute function to build profile from somewhere import some_typical_data
for _ in range(100):
critical_function(some_typical_data)
In Python 3.5 and later, you can distinguish between the profile and In Python 3.5 and later, you can distinguish between the profile and
non-profile runs as follows:: non-profile runs as follows::
if "_pgo_" in __name__: if "_pgo_" in __name__:
critical_function(profile_data) # generate execution profile ... # execute critical code here
""" """
args = magic_arguments.parse_argstring(self.cython, line) args = magic_arguments.parse_argstring(self.cython, line)
code = cell if cell.endswith('\n') else cell + '\n' code = cell if cell.endswith('\n') else cell + '\n'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment