pprofile style context profiling
See original GitHub issueI’m usually not interested in profiling an entire program, I’m more interested in profiling some hotspot of code, or just some new piece of code.
pprofile allows for just profiling a specific region of code (from pprofile’s main page):
def someOtherHotSpotCallable():
# Statistic profiler
prof = pprofile.StatisticalProfile()
with prof(
period=0.001, # Sample every 1ms
single=True, # Only sample current thread
):
# Code to profile
prof.print_stats()
It would be nice if scalene allowed for such granularity.
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (11 by maintainers)
Top Results From Across the Web
Relationship between Profile, Context and Preference
Figure 1 shows a comprehensive and iterative profiling process for personalisation, in four stages of information collection of user data, initialisation of the ......
Read more >The Python Profilers — Python 3.11.1 documentation
cProfile and profile provide deterministic profiling of Python programs. ... context manager (supported only in cProfile module. see Context Manager Types):.
Read more >Baseline Profiles - Android Developers
You can see this code in full context and more detail as part of our performance samples on GitHub. What to include. When...
Read more >Profiler API - React
The Profiler measures how often a React application renders and what the “cost” of rendering is. Its purpose is to help identify parts...
Read more >People, Profiles and Users - conf.researchr.org - Read the Docs
When profile information is shown in the context of that past conference, it will always reflect someone's bio/affiliation at the time/in the context...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My bad; I used
from scalene import profile
, but the trick is to, as you say, just use@profile
. I was just a bit confused because my IDE complained that in that caseprofile
isn’t defined anywhere.I changed it (removed my import) and it does seem to work.
PS: I loved your ACM Tech Talk. So many spot-on Simpsons references.
UPDATE: As of version 1.1.5, Scalene now supports
@profile
decorators.