This is an archive of the discontinued LLVM Phabricator instance.

[lldb][test] Speed up lldb arch determination (NFC)
ClosedPublic

Authored by kastiglione on Aug 27 2022, 4:44 PM.

Details

Summary

While investigation slow tests, I looked into TestMultithreaded.py. One
of the reasons that it's slow is the architecture of lldb is determined:

lldb -o 'file path/to/lldb' -o 'quit'

On my fairly fast machine, this takes 24 seconds, and TestMultithreaded.py
calls this function 5 times.

With this change, this command now takes less than 0.2s on the same machine.

The reason it's slow is symbol table and debug info loading, as indicated by
the new progress events printed to the console. One setting reduced the time in
half:

settings set target.preload-symbols false

Further investigation, by profiling with Instruments on macOS, showed that
loading time was also caused by looking for scripts. The setting that
eliminates this time is:

settings set target.load-script-from-symbol-file false

Using these two settings bring this overhead down to almost zero.

Diff Detail

Event Timeline

kastiglione created this revision.Aug 27 2022, 4:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 4:44 PM
kastiglione requested review of this revision.Aug 27 2022, 4:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2022, 4:44 PM

I did a little cleanup while here.

I wonder if it's worth disabling target.load-script-from-symbol-file for all tests as well.

kastiglione edited the summary of this revision. (Show Details)Aug 27 2022, 5:03 PM
kastiglione edited the summary of this revision. (Show Details)Aug 28 2022, 8:53 PM
This revision is now accepted and ready to land.Aug 29 2022, 10:11 AM
This revision was automatically updated to reflect the committed changes.
mib added a comment.Aug 29 2022, 11:01 AM

LGTM!

I wonder if it's worth disabling target.load-script-from-symbol-file for all tests as well.

I think this feature only works with dSYM bundles on macOS and only certain test would require to have it enabled. We should disable it and see if any test fails :)