##// END OF EJS Templates
match: improve includematcher.visitchildrenset to be much faster and cached...
match: improve includematcher.visitchildrenset to be much faster and cached This improves the speed of visitchildrenset considerably, especially when there are complicated matchers involved that may have many entries in _dirs or _parents. Unfortunately the benchmark isn't easily upstreamed due to its reliance on https://github.com/vstinner/perf (primarily due to the conflict when importing it if I were to contribute the benchmark as contrib/matcherbenchmarks.py) instead of asv or some other perf measurement system. To describe the benchmark briefly: I generated an includematcher of either 5 or 3500 "rootfilesin:prefix1/prefix2/prefix3/<randomsubdirs, 1-8 levels deep>" items in the 'setup' function, and then called `im.visitchildrenset('prefix1/prefix2')` in the 'stmt' function in perf.timeit. For the set of 5: - before: 15.3 us +- 2.9 us - after: 1.59 us +- 0.02 us For the set of 3500: - before: 3.90 ms +- 0.10 ms - after: 3.15 us +- 0.09 us (note the m->u change) Differential Revision: https://phab.mercurial-scm.org/D4351
Kyle Lippincott -
r39494:35ecaa99 default
Show More
Name Size Modified Last Commit Author
/ contrib / fuzz
Makefile Loading ...
README.rst Loading ...
bdiff.cc Loading ...
fuzzutil.cc Loading ...
fuzzutil.h Loading ...
mpatch.cc Loading ...
mpatch_corpus.py Loading ...
xdiff.cc Loading ...

How to add fuzzers (partially cribbed from oss-fuzz[0]):

  1. git clone https://github.com/google/oss-fuzz
  2. cd oss-fuzz
  3. python infra/helper.py build_image mercurial
  4. docker run --cap-add=SYS_PTRACE -it -v $HG_REPO_PATH:/hg-new
    gcr.io/oss-fuzz/mercurial bash
  5. cd /src
  6. rm -r mercurial
  7. ln -s /hg-new mercurial
  8. cd mercurial
  9. compile
  10. ls $OUT

Step 9 is literally running the command "compile", which is part of the docker container. Once you have that working, you can build the fuzzers like this (in the oss-fuzz repo):

python infra/helper.py build_fuzzers --sanitizer address mercurial $HG_REPO_PATH

(you can also say "memory", "undefined" or "coverage" for sanitizer). Then run the built fuzzers like this:

python infra/helper.py run_fuzzer mercurial -- $FUZZER

0: https://github.com/google/oss-fuzz/blob/master/docs/new_project_guide.md