Skip to content

Regex impl (#2607)#2607

Open
Orvid wants to merge 1 commit intofacebook:mainfrom
Orvid:export-D97922157
Open

Regex impl (#2607)#2607
Orvid wants to merge 1 commit intofacebook:mainfrom
Orvid:export-D97922157

Conversation

@Orvid
Copy link
Copy Markdown
Contributor

@Orvid Orvid commented Apr 1, 2026

Summary:

Execution style chosen: All of them.

This uses a backtracking implementation by default, but, unless it can prove it isn't needed, will track the number of backtracks that occur and fall back to the NFA, or, if available, DFA executor, if too many occur. This gets the perf benefits for the backtracking implementation by default in most cases, while also countering the worst-case-scenario.

For the benchmarks, Folly's implementation manages at least one, sometimes two, orders of magnitude improvement vs. the other regex implementations. The only implementations it currently falls behind in are a couple where CTRE wins. It also manages to beat CTRE in quite a few others, and importantly, is consistently fast. There are a number of patterns in the benchmarks where CTRE shows catastrophic performance, all of which this implementation handles without issue.

Work is still ongoing, the PR is only to see how the OSS tests behave.

Differential Revision: D97922157

@meta-cla meta-cla bot added the CLA Signed label Apr 1, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 1, 2026

@Orvid has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97922157.

@meta-codesync meta-codesync bot changed the title Regex impl Regex impl (#2607) Apr 1, 2026
Orvid added a commit to Orvid/folly that referenced this pull request Apr 1, 2026
Summary:

Execution style chosen: All of them. 

This uses a backtracking implementation by default, but, unless it can prove it isn't needed, will track the number of backtracks that occur and fall back to the NFA, or, if available, DFA executor if too many occur. This gets the perf benefits for the backtracking implementation by default in most cases, while also countering the worst-case-scenario.

For the benchmarks, Folly's implementation manages at least one, sometimes two, orders of magnitude improvement vs. the other regex implementations. The only implementations it currently falls behind in are a couple where RE2 wins, and a couple where CTRE wins. In cases where it's out-performed, it still manages to get very close to the performance of the other libraries :)

Work is still ongoing, the PR is only to see how the OSS tests behave.

Differential Revision: D97922157
@Orvid Orvid force-pushed the export-D97922157 branch 2 times, most recently from 3b75d28 to c704b24 Compare April 8, 2026 09:36
Orvid added a commit to Orvid/folly that referenced this pull request Apr 8, 2026
Summary:
Pull Request resolved: facebook#2607

Execution style chosen: All of them.

This uses a backtracking implementation by default, but, unless it can prove it isn't needed, will track the number of backtracks that occur and fall back to the NFA, or, if available, DFA executor if too many occur. This gets the perf benefits for the backtracking implementation by default in most cases, while also countering the worst-case-scenario.

For the benchmarks, Folly's implementation manages at least one, sometimes two, orders of magnitude improvement vs. the other regex implementations. The only implementations it currently falls behind in are a couple where RE2 wins, and a couple where CTRE wins. In cases where it's out-performed, it still manages to get very close to the performance of the other libraries :)

Work is still ongoing, the PR is only to see how the OSS tests behave.

Differential Revision: D97922157
Orvid added a commit to Orvid/folly that referenced this pull request Apr 8, 2026
Summary:
Pull Request resolved: facebook#2607

Execution style chosen: All of them.

This uses a backtracking implementation by default, but, unless it can prove it isn't needed, will track the number of backtracks that occur and fall back to the NFA, or, if available, DFA executor, if too many occur. This gets the perf benefits for the backtracking implementation by default in most cases, while also countering the worst-case-scenario.

For the benchmarks, Folly's implementation manages at least one, sometimes two, orders of magnitude improvement vs. the other regex implementations. The only implementations it currently falls behind in are a couple where CTRE wins. It also manages to beat CTRE in quite a few others, and importantly, is consistently fast. There are a number of patterns in the benchmarks where CTRE shows catastrophic performance, all of which this implementation handles without issue.

Work is still ongoing, the PR is only to see how the OSS tests behave.

Differential Revision: D97922157
@Orvid Orvid force-pushed the export-D97922157 branch from c704b24 to 5277b26 Compare April 8, 2026 09:44
@Orvid Orvid force-pushed the export-D97922157 branch from 5277b26 to 14dfb8a Compare April 15, 2026 11:04
Orvid added a commit to Orvid/folly that referenced this pull request Apr 15, 2026
Summary:
Pull Request resolved: facebook#2607

Execution style chosen: All of them.

This uses a backtracking implementation by default, but, unless it can prove it isn't needed, will track the number of backtracks that occur and fall back to the NFA, or, if available, DFA executor, if too many occur. This gets the perf benefits for the backtracking implementation by default in most cases, while also countering the worst-case-scenario.

For the benchmarks, Folly's implementation manages at least one, sometimes two, orders of magnitude improvement vs. the other regex implementations. The only implementations it currently falls behind in are a couple where CTRE wins. It also manages to beat CTRE in quite a few others, and importantly, is consistently fast. There are a number of patterns in the benchmarks where CTRE shows catastrophic performance, all of which this implementation handles without issue.

Work is still ongoing, the PR is only to see how the OSS tests behave.

Differential Revision: D97922157
Summary:
Pull Request resolved: facebook#2607

Execution style chosen: All of them.

This uses a backtracking implementation by default, but, unless it can prove it isn't needed, will track the number of backtracks that occur and fall back to the NFA, or, if available, DFA executor, if too many occur. This gets the perf benefits for the backtracking implementation by default in most cases, while also countering the worst-case-scenario.

For the benchmarks, Folly's implementation manages at least one, sometimes two, orders of magnitude improvement vs. the other regex implementations. The only implementations it currently falls behind in are a couple where CTRE wins. It also manages to beat CTRE in quite a few others, and importantly, is consistently fast. There are a number of patterns in the benchmarks where CTRE shows catastrophic performance, all of which this implementation handles without issue.

Work is still ongoing, the PR is only to see how the OSS tests behave.

Differential Revision: D97922157
@Orvid Orvid force-pushed the export-D97922157 branch from 14dfb8a to 102feeb Compare April 15, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant