This is an archive of the discontinued LLVM Phabricator instance.

[lit] Implement non-pipelined echo commands internally
ClosedPublic

Authored by rnk on Jul 6 2017, 3:01 PM.

Details

Summary

This speeds up the LLD test suite on Windows by 3x. Most of the time is
spent on lld/test/ELF/linkerscript/diagnostics.s, which repeatedly
constructs linker scripts with appending echo commands.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Jul 6 2017, 3:01 PM
chapuni added a subscriber: chapuni.Jul 6 2017, 5:36 PM
dlj edited edge metadata.Jul 6 2017, 6:01 PM

Looks pretty good... just a few nits and one suggestion.

llvm/utils/lit/lit/TestRunner.py
7 ↗(On Diff #105546)

Minor nit: you should usually have access to cStringIO, which might be faster. The common pattern to use it goes like this:

try:
  import cStringIO as StringIO
except ImportError:
  import StringIO
245 ↗(On Diff #105546)

Would it make sense to use while instead of if? (That would handle the case of 'echo -e -n blah').

262 ↗(On Diff #105546)

(Syntax nit) It looks like args will always be a list, even if it's 0-length, right? You can omit the if-check in that case (for-loop over an empty list is effectively a no-op).

421 ↗(On Diff #105546)

(Minor nit) For consistency, you might want to drop the outer parens. (Or leave them, I just wanted to double-check.)

rnk marked 3 inline comments as done.Jul 7 2017, 11:49 AM
rnk added inline comments.
llvm/utils/lit/lit/TestRunner.py
7 ↗(On Diff #105546)

Done. It's kind of a micro-optimization, so I wasn't sure if it was worth it.

262 ↗(On Diff #105546)

I need to check this for stdout.write(maybeUnescape(args[-1])), though. It seemed simpler to put the for loop inside the conditional as well.

421 ↗(On Diff #105546)

Oops, this was a two-line conditional that got shortened.

rnk updated this revision to Diff 105680.Jul 7 2017, 1:20 PM
rnk marked 2 inline comments as done.
  • comments
dlj accepted this revision.Jul 7 2017, 9:10 PM
This revision is now accepted and ready to land.Jul 7 2017, 9:10 PM
This revision was automatically updated to reflect the committed changes.