[PATCH 0 of 5] speed up check-code

Simon Heimberg simohe at besonet.ch
Sat Jun 8 13:56:58 CDT 2013


This patches speed up code checking by optimising pattern matching.

Fixing and compiling patterns is moved to module loading. Before this 
operations were done for each file to check, now they are only done once. 
This is an advantage when many files are checked.
Before the required patterns where checked and fixed only. (Only errors 
were prepared when no warnings, only patterns  for tests were prepared when 
only test files were checked). Now all patterns are prepared. This is a 
disadvantage when only checking some files. But the speed gain for 
checking many files is big compared to the slowdown for one file. (If it 
would get a problem, on access preparation could be implemented. But this 
is not this easy.)

Time measurements are inaccurate because jitter of run time is big. The 
values below show at least the tendencies.

=Patch 1: only fix patterns once=
run time for test-check-code-hg.t goes down from 64 to 60 s.
run time for checking single files goes up a bit, in the range of 0.4 s.

=Patch 2: only compile patterns once=
run time for test-check-code-hg.t goes down some seconds.
run time for checking a single file goes up some 0.1 seconds.

=Patch 3: only compile filters once=
Because there are only some filters
There is no speed loss for a single file because there are only some filters.

=Patch 4 + 5: use re2 for pattern matching=
no idea about the speedup of using re2 because it is not installed here


More information about the Mercurial-devel mailing list