pyutils / line_profiler

Line-by-line profiling for Python
Other
2.57k stars 118 forks source link

Add Quick Start to README #182

Closed BrianPugh closed 1 year ago

BrianPugh commented 1 year ago

No-nonsense terse instructions that say how to use line_profiler. In response to #174 .

Erotemic commented 1 year ago

This reminds me of how "weird" line profiler is to run. I forget because I often just use Erotemic/xdev, which exposes xdev.profile. It always exists, there isn't any magic builtins global injection. It is disabled by default an xdev.profile is effectively a no-op, it just returns the function it decorated.

I used to enable it by specifying --profile on the command line, but that can make it difficult to use with argparse, so I now recommend setting an environ XDEV_PROFILE=1 .

It would be nice to add something like that to line-profiler. We could keep all of the global injection with kernprof.py, but add this as an additional --- IMO simpler and doesn't break your normal workflow --- method of running line profiler.

Not a todo item, just thinking out loud.

Erotemic commented 1 year ago

Thank you!