Skip to content

replace inspect.stack() with a stack walk#534

Open
dcw02 wants to merge 1 commit into
Physical-Intelligence:mainfrom
dcw02:dcw02/optimized_stack_walk
Open

replace inspect.stack() with a stack walk#534
dcw02 wants to merge 1 commit into
Physical-Intelligence:mainfrom
dcw02:dcw02/optimized_stack_walk

Conversation

@dcw02

@dcw02 dcw02 commented Jun 17, 2025

Copy link
Copy Markdown

In certain execution environments with complex call stacks, inspect.stack() can become very expensive and add a significant amount of overhead to inference calls. This PR replaces it with a limited manual stack walk using sys._getframe() to avoid the overhead of loading all the stack frames.

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

Successfully merging this pull request may close these issues.

1 participant