Skip to content

perf(regular_expression): track regex flags via bitflags#22427

Merged
graphite-app[bot] merged 1 commit into
mainfrom
perf/regex-flags-bitmask
May 17, 2026
Merged

perf(regular_expression): track regex flags via bitflags#22427
graphite-app[bot] merged 1 commit into
mainfrom
perf/regex-flags-bitmask

Conversation

@Boshen

@Boshen Boshen commented May 14, 2026

Copy link
Copy Markdown
Member

Summary

Replace the FxHashSet<u32> used to detect duplicate flags in FlagsParser with a typed bitflags! set over u8. Avoids the per-regex hash-set allocation in flag parsing.

@Boshen Boshen requested a review from leaysgur as a code owner May 14, 2026 15:37
@codspeed-hq

codspeed-hq Bot commented May 14, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing perf/regex-flags-bitmask (4d1579c) with main (dbbc059)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen Boshen left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude[agent] try use bit flags

@Boshen Boshen marked this pull request as draft May 14, 2026 15:49
@Boshen Boshen self-assigned this May 14, 2026
@Claude

Claude AI commented May 14, 2026

Copy link
Copy Markdown
Contributor

@claude[agent] try use bit flags

Done in 9cb5589. Replaced manual bit manipulation with the bitflags! macro—defined a Flags struct with proper flag constants and used contains()/insert() methods instead of bitwise ops.

@Boshen Boshen force-pushed the perf/regex-flags-bitmask branch from 9cb5589 to 047f4b6 Compare May 15, 2026 15:30
@Boshen Boshen changed the title perf(regular_expression): track regex flags via u8 bitmask perf(regular_expression): track regex flags via bitflags May 15, 2026
@Boshen Boshen force-pushed the perf/regex-flags-bitmask branch from 047f4b6 to 4d1579c Compare May 15, 2026 15:57
@Boshen Boshen marked this pull request as ready for review May 15, 2026 15:57
@leaysgur leaysgur added the 0-merge Merge with Graphite Merge Queue label May 17, 2026

leaysgur commented May 17, 2026

Copy link
Copy Markdown
Member

Merge activity

## Summary

Replace the `FxHashSet<u32>` used to detect duplicate flags in `FlagsParser` with a typed `bitflags!` set over `u8`. Avoids the per-regex hash-set allocation in flag parsing.
@graphite-app graphite-app Bot force-pushed the perf/regex-flags-bitmask branch from 4d1579c to 98be95c Compare May 17, 2026 00:03
@graphite-app graphite-app Bot merged commit 98be95c into main May 17, 2026
28 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label May 17, 2026
@graphite-app graphite-app Bot deleted the perf/regex-flags-bitmask branch May 17, 2026 00:07
camc314 pushed a commit that referenced this pull request May 18, 2026
### 🐛 Bug Fixes

- 0f26de6 ecmascript: Resolve identifier value type via tracked
constants (#22234) (Alexander Lichter)
- c27a8cf minifier: Normalize `{ x: x }` shorthand so adjacent-if merge
is idempotent (#22401) (Dunqing)
- e431a0e parser: Break extends clause loop on fatal error (#22517)
(Boshen)
- e9ec7c6 minifier: Fold optional chains by base nullishness (#22236)
(Alexander Lichter)
- e6090e7 transformer: Keep enum IIFE when a non-inlinable value
reference remains (#22501) (Dunqing)
- 931b7d6 transformer: Inline const enum members through type-cast
wrappers (#22500) (Dunqing)
- b9615b2 codegen: Preserve string quotes in require() calls during
minification (#22475) (zennnnnnn11)
- c73c159 transformer/async-to-generator: Reparent parameter initializer
scopes (#22507) (camc314)
- ecfd3ca transformer/async-to-generator: Move only parameter bindings
(#22503) (camc314)
- 3ce3431 transformer/explicit-resource-managment: Preserve shadowed
for-head block (#22451) (camc314)

### ⚡ Performance

- ce92c6c semantic: `#[inline]` `Scoping::get_binding` (#22414)
(Dunqing)
- 98be95c regular_expression: Track regex flags via bitflags (#22427)
(Boshen)
- dbbc059 jsdoc: Skip should_attach_jsdoc when no remaining comments
(#22409) (Boshen)
- 217d7d8 minifier: Index `SymbolValues` by `SymbolId` (#22441)
(Dunqing)
- d782b78 minifier: Use BitSet for LiveUsageCollector live references
(#22425) (Boshen)
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.

3 participants