Commit 69e08695 authored by Stefan Behnel's avatar Stefan Behnel

Explain how to avoid the execution overhead during the non-profiling PGO compilation step.

parent 0578cb68
...@@ -270,6 +270,12 @@ class CythonMagics(Magics): ...@@ -270,6 +270,12 @@ class CythonMagics(Magics):
from somewhere import typical_data from somewhere import typical_data
critical_function(typical_data) # execute function to build profile critical_function(typical_data) # execute function to build profile
In Python 3.5 and later, you can distinguish between the profile and
non-profile runs as follows::
if "_pgo_" in __name__:
critical_function(profile_data) # generate execution profile
""" """
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