Mercurial > hg
view tests/readlink.py @ 18869:e8b4b139a545
dirstate: only call lstat once per flags invocation
This makes a big difference to performance in some cases.
hg --time locate 'set:symlink()'
mozilla-central (70,000 files):
before: 2.92 sec
after: 2.47
another repo (170,000 files):
before: 7.87 sec
after: 6.86
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Wed, 03 Apr 2013 11:35:27 -0700 |
parents | 08a0f04b56bd |
children | 328739ea70c3 |
line wrap: on
line source
#!/usr/bin/env python import errno, os, sys for f in sys.argv[1:]: try: print f, '->', os.readlink(f) except OSError, err: if err.errno != errno.EINVAL: raise print f, 'not a symlink' sys.exit(0)