D600: util: use set for reserved Windows filenames

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Sep 1 13:46:50 EDT 2017


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D600#9766, @quark wrote:
  
  > LGTM. Maybe include some timing data in commit message:
  >
  >   In [3]: _winreservednames = b'''con prn aux nul
  >      ...:     com1 com2 com3 com4 com5 com6 com7 com8 com9
  >      ...:     lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split()
  >      ...: 
  >  
  >   In [4]: %timeit 'lpt9' in _winreservednames
  >   The slowest run took 6.61 times longer than the fastest. This could mean that an intermediate result is being cached.
  >   1000000 loops, best of 3: 288 ns per loop
  >  
  >   In [5]: %timeit 'con' in _winreservednames
  >   The slowest run took 42.41 times longer than the fastest. This could mean that an intermediate result is being cached.
  >   10000000 loops, best of 3: 45 ns per loop
  >  
  >   In [6]: _winreservednames=set(_winreservednames)
  >  
  >   In [7]: %timeit 'con' in _winreservednames
  >   The slowest run took 28.03 times longer than the fastest. This could mean that an intermediate result is being cached.
  >   10000000 loops, best of 3: 42.5 ns per loop
  >  
  >   In [8]: %timeit 'lpt9' in _winreservednames
  >   10000000 loops, best of 3: 39.3 ns per loop
  
  
  The most relevant test is probably "'not-reserved' in _winreservednames" (which is probably close to the 'lpt9' test).

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D600

To: indygreg, #hg-reviewers, quark
Cc: martinvonz, quark, mercurial-devel


More information about the Mercurial-devel mailing list