-
Notifications
You must be signed in to change notification settings - Fork 327
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
Base_Tests
slowed down by 4min(!) due to too frequent get_source_location
calls
#12215
Comments
Base_Tests
slowed down by **4 minutes** due to too frequent get_source_location
callsBase_Tests
slowed down by 4min(!) due to too frequent get_source_location
calls
What was the overhead before the builtin was removed? |
But yeah so as we discussed we probably want to migrate towards fetching the location lazily only upon failure. The offsets changing and breaking the location code often was the issue why the location was computed more eagerly - at the beginning of the method it was easier to get stable offsets. As @JaroslavTulach we probably want to make the location lazy again and find the caller by something like:
although I think |
This is my idea how to "anchor a location" and find it in a stacktrace that's allocated later: from Standard.Base import all
type Where
Loc ~err ~run
main =
v = [1, 2, 3 ]
action anchor =
v.map x->
if x < 3 then x else
anchor_frame = anchor.err.stack_trace.at 0
anchor_name = anchor_frame.name.take (..While (ch-> ch!='<'))
whole = Runtime.get_stack_trace
stack = whole.drop (..While (frame-> anchor_name != frame.name))
IO.println "=== current stack is: ==="
whole.map IO.println
IO.println "=== simplified stack is: ==="
stack.map IO.println
x
where = Where.Loc (Error.throw "Here") (action where)
where.run
Nothing the output is:
e.g. even the failure happens inside of |
Greg Travis reports a new STANDUP for today (2025-02-04): Progress: - slow test locations
Next Day: default paramters |
Greg Travis reports a new STANDUP for today (2025-02-05): Progress: - anchor working for regular and nested calls
Next Day: make location dumps equal for entire test suite |
Does it make test execution fast(er)? |
I am running
Given the current situation I might even accept the locations to not be 100% correct, but the execution to be fast... |
Greg Travis reports a new STANDUP for today (2025-02-06): Progress: - switched to a simpler method that uses known function names instead of an anchor
Next Day: fix callback cases |
Greg Travis reports a new STANDUP for today (2025-02-07): Progress: - working to get callback behavior correct It should be finished by 2025-02-10. Next Day: fix callback cases; test through induced errors |
Running
test/Base_Tests
currently (2025.1.1-nightly.2025.1.30
) takes six minutes:most of the time seems to be taken by calls to
Test.get_source_location
which callsRuntime.get_stack_trace
since #12031. If I comment that code out:the whole execution speeds up to 2min 20s!
Test.get_source_location
upCCing @radeusgd as we already had a discussion about this issue:
That cannot be fast operation, alas. Even if we return back the
Meta.get_source_location
builtin (removed in #12031), it is not going to be too fast. We can take current location -Error.throw "here"
that's fast - but capturing the stack shall only be done when the test really fails.The text was updated successfully, but these errors were encountered: