Skip to content

Commit

Permalink
[status-] decrease latency of status() when other threads run
Browse files Browse the repository at this point in the history
Inspect is slow to look up context lines, so stack(0) is
a bit faster. See https://stackoverflow.com/a/17407257
When other busy threads run, stack() can have high latency,
more than 100ms. stack(0) has much less latency in that
situation.
  • Loading branch information
midichef committed Apr 4, 2024
1 parent 581cdf1 commit c9d8a81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion visidata/features/status_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@VisiData.api
def getStatusSource(vd):
stack = inspect.stack()
stack = inspect.stack(0) #2370
for i, sf in enumerate(stack):
if sf.function in 'status aside'.split():
if stack[i+1].function in 'error fail warning debug'.split():
Expand Down

0 comments on commit c9d8a81

Please sign in to comment.