Scalene decorator
See original GitHub issueIs your feature request related to a problem? Please describe.
At this moment we can only run Scalene on the entire application, which makes profiling a time consuming process. It would be nice to have more fine-grained control over the functionality that should be profiled.
Describe the solution you’d like
Create a decorator that can be used to activate the profiler for specific functions / classes.
@scalene
def func_under_test():
...
Next create an environment variable that contains a list with all the functions that should be profiled
SCALENE_PROFILE_FUNCTIONS=func_under_test,another_func_under_test
Describe alternatives you’ve considered Write a separate script that can be run specific functionality.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Scalene: a high-performance CPU, GPU and memory profiler ...
Scalene : a high-performance, high-precision CPU, GPU, and memory profiler for ... Scalene supports @profile decorators to profile only specific functions.
Read more >scalene 0.9.16 - PyPI
Scalene is a high-performance CPU and memory profiler for Python that does a number of things that other Python profilers do not and...
Read more >Scalene - CPU and Memory Profiler for Python Code
The scalene is a high-performance CPU usage and memory profiler for python code. It works comparatively faster than other python profilers like ...
Read more >That time I optimized a Python program by 5000x - Reddit
We developed Scalene to be a lot more useful than existing Python profilers: it provides line-level information, splits out Python from native ...
Read more >Profiling - AI Engineer Guide
To use the library, we first add the decorator @profile to the functions or methods you want to ... from scalene import scalene_profiler...
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
Hey @emeryberger, on a similar note to the decorator, any plans to make it possible to run Scalene programmatically from within the code like cProfile.
While this is not the requested
@scalene
operator, it fits with established practice by other profilers, and I think addresses this issue. Please feel free to re-open if not!