Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to PCRE2 API and enable JIT compilation #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rfrancoise
Copy link
Contributor

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant