Skip to content

Comments

Replace globset with glob-set GlobMap in CompiledCatalog#93

Open
macalinao wants to merge 4 commits intomasterfrom
globset
Open

Replace globset with glob-set GlobMap in CompiledCatalog#93
macalinao wants to merge 4 commits intomasterfrom
globset

Conversation

@macalinao
Copy link
Contributor

@macalinao macalinao commented Feb 24, 2026

Summary

  • Migrates schemastore::CompiledCatalog from the external globset crate to our own glob-set crate's GlobMap
  • Removes the hand-rolled three-tier optimization (exact filename BTreeMap, per-extension GlobSets, fallback GlobSet) — GlobMap's MatchEngine already provides these optimizations (literal hash, extension hash, prefix/suffix tries, Aho-Corasick)
  • Patterns without / are prepended with **/ at compile time so they match at any directory depth, eliminating the two-step path-then-filename matching

Test plan

  • cargo test -p schemastore — all 9 existing tests pass
  • cargo test -p lintel-identify -p lintel-validate -p lintel-annotate -p lintel — all 150 downstream tests pass
  • cargo check --workspace — clean compile
  • Pre-commit hooks (clippy, rustfmt) pass

Introduce two new no_std crates as lighter alternatives to globset (no regex):

- glob-matcher: no_std fork of glob-match 0.2.1 (MIT)
- glob-set: globset-compatible API with strategy-based dispatch
  (extension hash, literal, prefix, suffix, compound suffix,
  prefix+suffix, brace expansion) and Aho-Corasick pre-filter fallback.
  2x faster than globset for matching, 21x faster for building.

Also fix cargo-furnish to skip workspace license inheritance when a
crate ships its own LICENSE file (e.g. glob-matcher's MIT license).
…obMap, TinyGlobSet

Replace the hand-rolled arena tries (PrefixTrie/SuffixTrie) with the tried
crate's double-array trie for O(key-length) prefix/suffix lookups. Extract
shared matching logic into a MatchEngine (with first_match support) that
backs both GlobSet and the new GlobMap. Rename the original linear-scan
implementation to TinyGlobSet for use cases where fast build time matters
more than query throughput.
Move crate-level documentation into README.md with three doctest-verified
examples (exact-match, common-prefix search, zero-copy borrowed data).
Use include_str! to pull the README as crate docs. Standardize Cargo.toml
description and use workspace license.
Migrate schemastore's CompiledCatalog from the external `globset` crate
with a hand-rolled three-tier optimization (exact filename BTreeMap,
per-extension GlobSets, fallback GlobSet) to a single `GlobMap` from our
`glob-set` crate. The GlobMap's MatchEngine already provides these
optimizations (literal hash, extension hash, prefix/suffix tries,
Aho-Corasick), making the three-tier scheme unnecessary.

Patterns without `/` are now prepended with `**/` during compilation so
they match at any directory depth, eliminating the need for separate
path-then-filename matching.
@macalinao macalinao changed the title Add tried README with doctest examples Replace globset with glob-set GlobMap in CompiledCatalog Feb 24, 2026
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