# zeta: Improve efficiency and clarity of license detection patterns \(\#37242\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/253765aaa1f15d45e2effe098222d07550fdf0e9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 253765aaa1f15d45e2effe098222d07550fdf0e9

Requested commit: 253765aaa1f15d45e2effe098222d07550fdf0e9

Commit: 253765aaa1f15d45e2effe098222d07550fdf0e9

Tree: 7bd088365789d55ad4bd0bc483cd5c0777493eea

Author: Michael Sloan

Committer: GitHub

## Message

```
zeta: Improve efficiency and clarity of license detection patterns (#37242)

See discussion on #36564

Adds a simple ad-hoc substring matching pattern language which allows
skipping a bounded number of chars between matched substrings. Before
this change compiling the regex was taking ~120ms on a fast machine and
~8mb of memory. This new version is way faster and uses minimal memory.

Checked the behavior of this vs by running it against 10k licenses that
happened to be in my home dir. There were only 4 differences of behavior
with the regex implementation, and these were false negatives for the
regex implementation that are true positives with the new one.

Of the ~10k licenses in my home dir, ~1k do not match one of these
licenses, usually because it's GPL/MPL/etc.

Release Notes:

- N/A
```

## Parents

- [ad746f25f268ef0ad3aeddc41bc05287c1d0d006](https://git.cafe/gitcafe/zed/commit/ad746f25f268ef0ad3aeddc41bc05287c1d0d006?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/253765aaa1f15d45e2effe098222d07550fdf0e9?format=markdown)
