-
Notifications
You must be signed in to change notification settings - Fork 49
Use a bitset for ascii-only character classes #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5fd8840
03fe8d6
5667705
bde259b
bf95e81
243ec7b
eeb0852
49efd67
b3a61a7
926d208
752ea76
7327e74
7a900b6
50e8e6d
3c7f62c
b71b177
e2a011c
f7900e5
e9d1902
cf59091
f4019d4
ed82cb0
cc1ac9d
ccf6ade
7b83e0c
5121076
3607b65
291a974
ddcf40f
f87b325
2d8ac2d
fd66693
22c8213
0781b93
ffff944
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,19 @@ | |
extension Compiler { | ||
struct ByteCodeGen { | ||
var options: MatchingOptions | ||
private let compileOptions: CompileOptions | ||
var builder = MEProgram.Builder() | ||
/// A Boolean indicating whether the first matchable atom has been emitted. | ||
/// This is used to determine whether to apply initial options. | ||
var hasEmittedFirstMatchableAtom = false | ||
|
||
init(options: MatchingOptions, captureList: CaptureList) { | ||
init( | ||
options: MatchingOptions, | ||
compileOptions: CompileOptions, | ||
captureList: CaptureList | ||
) { | ||
self.options = options | ||
self.compileOptions = compileOptions | ||
self.builder.captureList = captureList | ||
} | ||
} | ||
|
@@ -644,7 +650,8 @@ fileprivate extension Compiler.ByteCodeGen { | |
_ ccc: DSLTree.CustomCharacterClass | ||
) throws { | ||
if let asciiBitset = ccc.asAsciiBitset(options), | ||
options.semanticLevel == .graphemeCluster { | ||
options.semanticLevel == .graphemeCluster, | ||
!compileOptions.contains(.unoptimized) { | ||
// future work: add a bit to .matchBitset to consume either a character | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make sure we do this soon? I want to have as much of a unified performance story between grapheme semantic and scalar semantic as possible. Ideally a lot of perf analysis will be downgrading grapheme to scalar operations as permitted. Having two different paths also complicates testing, as now many tests that were exhaustively testing the engine are now only testing one path in the engine. We'll need to meet to discuss testing and validation as we add special-case optimizations. |
||
// or a scalar so we can have this optimization in scalar mode | ||
builder.buildMatchAsciiBitset(asciiBitset) | ||
|
Uh oh!
There was an error while loading. Please reload this page.