# HG changeset patch # User Bryan O'Sullivan # Date 1451973286 28800 # Node ID e9f099ede405264c0e0d3bf10965e83fe2b983ed # Parent a1eff44c432b6aa346484184072365544d2d4e67 tests: only stat a test file if we don't already know its "cost" diff -r a1eff44c432b -r e9f099ede405 tests/run-tests.py --- a/tests/run-tests.py Mon Jan 04 21:54:44 2016 -0800 +++ b/tests/run-tests.py Mon Jan 04 21:54:46 2016 -0800 @@ -1845,18 +1845,24 @@ b'gendoc': 100, b'contrib-perf': 200, } + perf = {} def sortkey(f): # run largest tests first, as they tend to take the longest try: - val = -os.stat(f).st_size - except OSError as e: - if e.errno != errno.ENOENT: - raise - return -1e9 # file does not exist, tell early - for kw, mul in slow.items(): - if kw in f: - val *= mul - return val + return perf[f] + except KeyError: + try: + val = -os.stat(f).st_size + except OSError as e: + if e.errno != errno.ENOENT: + raise + perf[f] = -1e9 # file does not exist, tell early + return -1e9 + for kw, mul in slow.items(): + if kw in f: + val *= mul + perf[f] = val + return perf[f] tests.sort(key=sortkey) self._testdir = osenvironb[b'TESTDIR'] = getattr(