You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: benchmarking/README.md
+28-10Lines changed: 28 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,11 +15,11 @@ npm run bench --workspace=benchmarking
15
15
16
16
Isolates the cost of `PartialMatchRegExp`'s `exec()` override. All three candidates run the same underlying partial pattern against the same input — the only variable is whether a JavaScript wrapper sits in the call chain:
17
17
18
-
| Candidate | Notes |
19
-
|---|---|
20
-
| Native `RegExp.exec`| Baseline — no partial transform, no override |
| HTML open/close tag (`/^<([a-z]+)>[^<]+<\/\1>$/`) |`"<div>hello</div>"`|
58
58
59
59
Each pattern is measured at three stages — full match (native fast path), partial input before the backreference atom is reached, and partial input mid-backreference — plus an accumulated keystroke simulation that sums the cost over all prefixes.
60
60
61
+
### 5. Construction cost (`construction-cost.bench.ts`)
62
+
63
+
Scenarios 1-4 build every candidate once outside the timed loop, so they never see the cost of `compilePartial()`'s walk()/render() pass — the one-time parsing work done per `new PartialMatchRegExp()`. This scenario isolates that cost so walk additions can be tracked independently of the exec-time scenarios above.
| Simple (`/^hello+$/`) | No groups, no character classes, no backreferences |
76
+
| Phone number | Several character classes and optional groups, no backreferences |
77
+
| HTML tag | Capturing group + backreference — exercises the dynamic path |
78
+
61
79
## 🤖 CI integration
62
80
63
81
The workflow at [`.github/workflows/benchmark.yml`](../.github/workflows/benchmark.yml) runs on every push to `main` and on pull requests targeting `main`.
0 commit comments