fix Issue 18114 - regex performance regression#5981
Conversation
|
Thanks for your pull request, @MartinNowak! Bugzilla references
|
|
Somewhat tricky, but would be best if we could deprecate usage of ctRegexs as mutable Regex, instead making "logically const" copies. |
DmitryOlshansky
left a comment
There was a problem hiding this comment.
LGTM!
And thanks for figuring it out
std/regex/package.d
Outdated
| // allow code that expects mutable Regex to still work | ||
| // we stay "logically const" | ||
| @trusted @property auto getRe() const { return cast() staticRe; } | ||
| @property ref getRe() const { return staticRe; } |
There was a problem hiding this comment.
I recall some code that broke because of this change on Jenkins auto-tester.
Dunno if we should could overload both by ref and bu value
There was a problem hiding this comment.
If that's the problem would replacing ref with auto ref fix it?
There was a problem hiding this comment.
I recall some code that broke because of this change on Jenkins auto-tester.
Yeah. Higgs fails:
parser/lexer.d(548): Error: none of the overloads of 'match' are callable using argument types (Wrapper), candidates are:
parser/lexer.d(335): parser.lexer.StrStream.match(wstring str)
parser/lexer.d(351): parser.lexer.StrStream.match(Regex!wchar re)
parser/lexer.d(664): Error: none of the overloads of 'match' are callable using argument types (Wrapper), candidates are:
parser/lexer.d(335): parser.lexer.StrStream.match(wstring str)
parser/lexer.d(351): parser.lexer.StrStream.match(Regex!wchar re)
parser/lexer.d(687): Error: none of the overloads of 'match' are callable using argument types (Wrapper), candidates are:
parser/lexer.d(335): parser.lexer.StrStream.match(wstring str)
parser/lexer.d(351): parser.lexer.StrStream.match(Regex!wchar re)
parser/lexer.d(699): Error: none of the overloads of 'match' are callable using argument types (Wrapper), candidates are:
parser/lexer.d(335): parser.lexer.StrStream.match(wstring str)
parser/lexer.d(351): parser.lexer.StrStream.match(Regex!wchar re)
makefile:77: recipe for target 'test' failed
https://ci.dlang.io/blue/organizations/jenkins/dlang-org%2Fphobos/detail/PR-5981/1/pipeline
This reverts commit 7bf26af.
- reduce copying of fat structs - optimize layouts and opAssign of Captures
77a2762 to
12182f8
Compare
|
Rebased and ready to be pulled. |
12182f8 to
3f52ab1
Compare
- needed for compatibility with existing ctRegex users (e.g. Higgs) - cast reference instead of value to avoid copying
3f52ab1 to
7283f68
Compare
|
Auto-merge toggled on |
WIP: still need to figure out how to best handle ref passing of ctRegex