GitShow/denoland/monch
denoland

monch

Inspired by nom, but specifically for strings.

by denoland
Star on GitHubFork

Rust

82 stars4 forks4 contributorsQuiet · 2mo agoSince 20220.6.0MIT

Meet the team

See all 4 on GitHub →
dsherret
dsherret16 contributions
denobot
denobot9 contributions
bartlomieju
bartlomieju1 contribution
hashrock
hashrock1 contribution

Languages

View on GitHub →
Rust100%

Commit activity

Last 12 weeks · 2 commits

Full graph →

Community health

2 of 6 standards met

Community profile →
37
✓README✓License○Contributing○Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
dsherret
perf(BREAKING): various optimizationsMergedPR

Summary Performance pass over the parser combinators. The big wins are on per-call hot paths: (~25–35% faster), (~2× faster), and a smaller from boxing the failure variant. Also adds for runtime-built tags so the default can drop its allocation. Includes a divan bench harness. ## Changes Hot-path wins (verified by bench): now precomputes a ASCII bitmap at construction and falls back to a only for non-ASCII chars in the set. Replaces a substring scan per call. 3.98 ns vs 5.98 ns on a 53-char identifier set. written directly instead of going through . 0.55–0.70 ns vs 1.04–1.14 ns, ~2× faster. Smaller : now wraps . The common path no longer carries the size of a full failure ( + ). Not benched in isolation but reduces stack-write width on every combinator return. Allocation removal: now takes — no per-construction . Most call sites pass literals. New for the runtime case, so the old behavior is opt-in. 's code snippet uses + slice + (one alloc) instead of (char-by-char push). and take so callers passing an owned no longer reallocate. and preallocate the combined error message with the exact final capacity. Failure-path cleanup: consumes the result once instead of re-running the (possibly expensive) combinator on the failure path. Investigated but rejected: in /. Bench showed it's a ~2.5× regression for the empty case (18 ns vs 7 ns) and tied otherwise — is zero-alloc until first push and libstd's first growth lands at 4 anyway. Kept . Other improvements on every small leaf/wrapper combinator (, , , , , , , , , , , /–, , , , , , , , , , , , , /, ). ASCII fast path in (branch-on-captured-bool, folds away after inlining), , and — non-ASCII falls through to the existing char-aware path via a separate helper marked so the hot path stays small. New ASCII-byte variants: / for callers that know their predicate is ASCII (, , etc.) — avoids UTF-8 decoding entirely. New fold/count combinators:** , , , — let callers avoid the allocation in / when they only need a derived value. 12 new unit tests covering every new public function (96 total, all green). ## Breaking changes (warrant an 0.x minor version bump) wraps ; pattern matchers/constructors must adjust. now takes (was ). Use for runtime strings. and take (was ); callers passing need .

dsherret · 2mo ago
bartlomieju
0.6.0MergedPR
bartlomieju · 2mo ago
dsherret
chore: fix release workflowMergedPR
dsherret · 9mo ago
Structured data for AI agents

Repository: denoland/monch. Description: Inspired by nom, but specifically for strings. Stars: 82, Forks: 4. Primary language: Rust. Languages: Rust (100%). License: MIT. Latest release: 0.6.0 (2mo ago). Open PRs: 0, open issues: 0. Last activity: 2mo ago. Community health: 37%. Top contributors: dsherret, denobot, bartlomieju, hashrock.

·@ofershap

Replace github.com with gitshow.dev