rust-manifest: use `memchr` crate for all byte-finding needs
While writing a very dumb manifest diffing algorithm for a proof-of-concept
I saw that `Manifest::find_by_path` was much slower than I was expecting.
It turns out that the Rust stdlib uses slow (all is relative) code when
searching for byte positions for reasons ranging from portability, SIMD
API stability, nobody doing the work, etc. `memch` is much faster for these
purposes, so let's use it.
I was measuring ~670ms of profile time in `find_by_path`, after this patch
it went down to ~230ms.
syntax: glob
*.elc
*.tmp
*.orig
*.rej
*~
*.mergebackup
*.o
*.so
*.dll
*.exe
*.pyd
*.pyc
*.pyo
*$py.class
*.swp
*.prof
*.zip
\#*\#
.\#*
result/
tests/artifacts/cache/big-file-churn.hg
tests/.coverage*
tests/.testtimes*
# the file is written in the CWD when run-tests is run.
.testtimes
tests/.hypothesis
tests/hypothesis-generated
tests/annotated
tests/exceptions
tests/python3
tests/*.err
tests/htmlcov
build
contrib/chg/chg
contrib/hgsh/hgsh
contrib/vagrant/.vagrant
contrib/merge-lists/target/
dist
packages
doc/common.txt
doc/commandlist.txt
doc/extensionlist.txt
doc/topiclist.txt
doc/*.mk
doc/*.[0-9]
doc/*.[0-9].txt
doc/*.[0-9].gendoc.txt
doc/*.[0-9].{x,ht}ml
doc/build
doc/html
doc/man
MANIFEST
MANIFEST.in
patches
mercurial/__modulepolicy__.py
mercurial/__version__.py
mercurial/hgpythonlib.h
mercurial.egg-info
.DS_Store
tags
cscope.*
.vscode/*
.idea/*
.asv/*
.pytype/*
.mypy_cache
i18n/hg.pot
locale/*/LC_MESSAGES/hg.mo
hgext/__index__.py
rust/target/
rust/*/target/
# Generated wheels
wheelhouse/
syntax: rootglob
# See Profiling in rust/README.rst
.cargo/config
syntax: regexp
^\.pc/
^\.(pydev)?project
# hackable windows distribution additions
^hg-python
^hg.py$