question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scalene decorator

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Samira-Elcommented, Sep 24, 2020

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.

0reactions
emerybergercommented, Oct 24, 2020

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found