Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing line_profiler #188

Open
jtlz2 opened this issue Nov 22, 2022 · 2 comments
Open

Customizing line_profiler #188

jtlz2 opened this issue Nov 22, 2022 · 2 comments

Comments

@jtlz2
Copy link

jtlz2 commented Nov 22, 2022

I love the module and have been using it for years, for which many thanks.

A StackOverflow question appeared yesterday asking - wait for it - about type checking (32-bit vs 64-bit) for every function call. Here is the Q:

https://stackoverflow.com/questions/74516195/detecting-unexpected-type-conversion-in-python

I suggested line_profiler (or memory_profiler) might be hackable along the lines of https://stackoverflow.com/a/74517678/1021819

Do you have any advice on whether customizing line_profiler in this way would be feasible, and if so how one might go about it?

Thanks again!

@Erotemic
Copy link
Member

Because this repo requires each function is manually registered to be profiled, I think this might not be a fit. However, there were discussions about automatically discovering and profiling all functions automatically, which is more aligned with what you need.

See #21 and #24 I thought there was another where I discuss using code in xdoctest / mkinit to automatically enumerate items to profile, but I can't find it.

@ta946
Copy link

ta946 commented Dec 10, 2022

i dont recommend following whats in issues #21 & #24. they are very hacky and inefficient.
I've updated the code to use AST which is alot more reliable. you can follow the changes i made in my fork under autoprofile branch and use it as a stepping stone to get what you want as I don't plan on maintaining my fork and keeping it up to date.

also @Erotemic you were looking for this discussion where you mentioned using xdoctest. And if you have some free time i've responded in there that my autoprofiler is close to completion :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants