[PATCH V2] fsmonitor: match watchman and filesystem encoding
Siddharth Agarwal
sid at less-broken.com
Wed Apr 5 16:43:21 EDT 2017
On 4/5/17 13:30, Olivier Trempe wrote:
> Absolutely. This will be fixed in V3.
> I also realize the "import sys" statement was removed 3 months ago. I
> missed it when rebasing... This will also be fixed in V3.
Thanks.
In general, do you think you could add a test for the behavior where
fsmonitor currently fails? I assume any non-ASCII filenames will cause
issues.
>
> >>
> >> +
> >> + return decoded.encode(_fsencoding, 'replace')
> >> +
> >> def overridewalk(orig, self, match, subrepos, unknown, ignored,
> full=True):
> >> '''Replacement for dirstate.walk, hooking into Watchman.
> >> @@ -303,6 +323,8 @@
> >> # for name case changes.
> >> for entry in result['files']:
> >> fname = entry['name']
> >> + if _fixencoding:
> >> + fname = _watchmantofsencoding(fname)
> >
> >
> > This is a critical path IIRC, so I'm a little concerned about
> performance here -- both on Mac/Linux where _fixencoding will
> (always?) be false and on Windows where it will (always?) be true.
> >
> > Any chance you you could measure the before and after with (say)
> 10,000 files in the result set? Thanks!
> >
>
> There is a little overhead at module import:
> python -m timeit "import hgext.fsmonitor"
> Windows before patch: 1000000 loops, best of 3: 0.563 usec per loop
> Windows after patch: 1000000 loops, best of 3: 0.583 usec per loop
> Linx before patch: 1000000 loops, best of 3: 0.628 usec per loop
> Linux after patch: 1000000 loops, best of 3: 0.579 usec per loop
>
> 10000 calls to _watchmantofsencoding:
> python -m timeit -s "from hgext.fsmonitor import
> _watchmantofsencoding, _fixencoding" "fname = '/path/to/file'" "for i
> in range(10000):" " if _fixencoding: fname =
> _watchmantofsencoding(fname)"
> Windows (_fixencoding is True): 100 loops, best of 3: 19.5 msec per loop
> Linux (_fixencoding is False): 100 loops, best of 3: 3.08 msec per loop
>
> Do you want me to include these results in the commit message?
Yes, that would be great! Thanks.
>
> >
> >> if switch_slashes:
> >> fname = fname.replace('\\', '/')
> >> if normalize:
> >
> >
> >
More information about the Mercurial-devel
mailing list