panel.io.profile module#

panel.io.profile.profile(name: str, engine: ProfilingEngine = 'pyinstrument') Callable[[Callable[_P, _R]], Callable[_P, _R]][source]#

A decorator which may be added to any function to record profiling output.

Parameters:
name: str

A unique name for the profiling session.

engine: str

The profiling engine, e.g. ‘pyinstrument’, ‘snakeviz’ or ‘memray’

panel.io.profile.profile_ctx(engine: ProfilingEngine = 'pyinstrument') Iterator[Sequence[Profile | bytes | Session]][source]#

A context manager which profiles the body of the with statement with the supplied profiling engine and returns the profiling object in a list.

Parameters:
engine: str

The profiling engine, e.g. ‘pyinstrument’, ‘snakeviz’ or ‘memray’

Returns:
sessions: list

A list containing the profiling session.