Page MenuHomePhabricator

Make check-llvm run 50% faster on macOS, 18% faster on Windows.
ClosedPublic

Authored by thakis on Jan 6 2020, 7:59 AM.

Details

Reviewers
rnk
dsanders
Summary

While looking at cycle time graphs of some of my bots, I noticed
that 327894859cc made check-llvm noticeably slower on macOS and
Windows.

As it turns out, the 5 substitutions added in that change were
enough to cause lit to thrash the built-in cache in re.compile()
(re.sub() is implemented as re.compile().sub()), and apparently
applySubstitutions() is on the critical path and slow when all
regexes need to compile all the time.

(See _MAXCACHE = 512 in cpython/Lib/re.py)

Supporting full regexes for lit substitutions seems a bit like
overkill, but for now add a simple unbounded cache to recover
the lost performance.

No intended behavior change.

Diff Detail

Event Timeline

thakis created this revision.Jan 6 2020, 7:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2020, 7:59 AM
Herald added a subscriber: delcypher. · View Herald Transcript
thakis marked an inline comment as done.Jan 6 2020, 8:00 AM
thakis added inline comments.
llvm/utils/lit/lit/TestRunner.py
1124

(This is just a reflowing, for PEP-8 complicance.)

dsanders accepted this revision.Jan 6 2020, 9:55 AM

LGTM. Thanks!

This revision is now accepted and ready to land.Jan 6 2020, 9:55 AM
thakis closed this revision.Jan 6 2020, 10:00 AM

Thanks!

Landed in f6544934b94932f1d2231238046f83ba8b083040, sadly forgot to add the "Differential Revision:" footer.

thakis edited the summary of this revision. (Show Details)Jan 6 2020, 10:08 AM
thakis edited the summary of this revision. (Show Details)