Port to PCRE2 API and enable JIT compilation #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original PCRE API provided on most systems by libpcre3 is no longer
maintained upstream and is superseded by the new PCRE2 API, which was
first released in 2015. pcre3 will be removed from Debian in 2023, as
noted in this bug report: https://bugs.debian.org/1000080
This commit replaces the existing PCRE implementation with a new one
using PCRE2, which is quite similar. One benefit is that PCRE2 provides
a JIT compiler which can replace the interpretive regular expression
evaluation code with native machine code on most modern platforms:
https://pcre.org/current/doc/html/pcre2jit.html
Depending on the length and complexity of the pattern used, enabling JIT
compilation makes Ngrep 50x to 150x faster, testing in quiet mode on a
multi-gigabyte PCAP file stored on tmpfs.