Nifty Python Profiler
Profile Python scripts and pytest runs with cProfile: hotspot table, call counts and timings inline next to each function.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features


- One-click profiling. Run the current Python file under
cProfile from the editor's Run menu (next to the play button), the right-click menu or the Explorer. Pass arguments with Profile Current File with Arguments…; they're remembered per file.
- Profile pytest runs. Right-click a
test_*.py file to profile just that file, or profile the whole suite. Extra pytest arguments go in nifty.python-profiler.pytestArgs.
- Hotspot table. Every function with its calls, own time, total time and time per call. Sort by any column, filter by name or file, hide libraries and built-ins, and click a row to jump to the code and see who called it.
- Timings inline in your code. Each profiled function shows
⏱ 1.20 s (38.5%) · own 12.0 ms · 3 calls at the end of its def line. Functions over 10% of the run are highlighted, and hovering shows the details and the callers.
- Works with saved profiles. Open any
.prof / .pstats file (from python -m cProfile -o, Django or pytest plugins), or save a run to open later in SnakeViz or pstats.
- Uses your interpreter. Picks up the interpreter selected in the Python extension (venvs, conda, uv), falls back to
python on your PATH, or set one explicitly.
- Nothing to install.
cProfile ships with Python, so there's no package to add to your project.
Commands
| Command |
What it does |
Nifty Python Profiler: Profile Current File |
Run the current file under cProfile and show the results |
Nifty Python Profiler: Profile Current File with Arguments… |
Same, with command-line arguments for the script |
Nifty Python Profiler: Profile pytest Run |
Profile the current test file, or the whole pytest suite |
Nifty Python Profiler: Open Profile File (.prof)… |
Load a saved cProfile / pstats file |
Nifty Python Profiler: Show Profile Results |
Reopen the hotspot table |
Nifty Python Profiler: Save Profile As… |
Save the current run as a .prof file |
Nifty Python Profiler: Toggle Inline Timings |
Show or hide timings in the editor |
Nifty Python Profiler: Clear Profile |
Remove the timings from the editor |
Settings
| Setting |
Default |
What it does |
nifty.python-profiler.pythonPath |
"" |
Interpreter to use. Empty uses the Python extension's selection, then python/python3 |
nifty.python-profiler.pytestArgs |
[] |
Extra arguments for pytest runs |
nifty.python-profiler.inlineTimings |
true |
Show timings at the end of each profiled def line |
nifty.python-profiler.hotThresholdPercent |
10 |
Highlight functions that take at least this share of the run |
nifty.python-profiler.openResults |
true |
Open the hotspot table after each run |
nifty.python-profiler.showProgramOutput |
true |
Show the program's output while profiling |
Tips
- Own time is time spent in the function's own code; total time includes everything it calls. Start with the biggest total time, then drill into the callee with the biggest own time.
- cProfile measures function calls, so very fast functions called millions of times look slower than they are. Compare with and without profiling before optimizing them.
Install
- VS Code: search for "Nifty Python Profiler" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Privacy
This extension collects no telemetry and needs no account.
- Nifty pytest: pytest Test Explorer: A pytest test explorer with saved run configurations, marker filters, real assertion diffs, rerun-failed and slowest-test reports. (Open VSX)
- Nifty JS Tests: Mocha, node:test & Bun in Test Explorer: Run and debug Mocha, node:test and Bun tests from the Test Explorer: real diffs, stack locations, watch mode, TypeScript loaders and monorepos. No Jest or Vitest. (Open VSX)
- Nifty Python Pack: 7 Nifty extensions for Python development: Python Envs, pytest, Python Profiler, Python REPL, Docstrings, Paired Notebooks, Notebook Servers. (Open VSX)
- Nifty .NET Explorer: Solution & Test Explorer: A solution explorer and test explorer for .NET in VS Code, Cursor, Windsurf and VSCodium: projects, references and files from .sln/.slnx, and xUnit, NUnit and MSTest tests in the Testing view. (Open VSX)
- Nifty Bash Debugger: Breakpoints & Step Through Scripts: Debug Bash scripts without bashdb: breakpoints, conditions, logpoints, stepping, call stack, variables and arrays. Works with bash 4.2 to 5.2+ and Git Bash on Windows. (Open VSX)
- Nifty Code Runner: Run Code in 25+ Languages: Run the current file or selection in 25+ languages in the terminal, with input support, your own commands and no telemetry. (Open VSX)
See all 100+ Nifty extensions and web tools at https://getnifty.dev
| |