-
-
Notifications
You must be signed in to change notification settings - Fork 724
perf(lexer): improve byte_handlers for ! and ?
#12831
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
perf(lexer): improve byte_handlers for ! and ?
#12831
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #12831 will not alter performanceComparing Summary
Footnotes |
Merge activity
|
5819c60 to
ae0137c
Compare
|
@Boshen Just FYI, the reason for the more complicated implementation before was that I see this change was suggested by AI in #12765, which confidently asserted that the simpler version is more performant. I'm not sure that's true or not. Benchmarks don't seem to show much either way. I don't propose reverting this change, but just to let you know there was a reason why it was how it was. |
My advice is, add more context to these functions to let AI know. btw AI couldn't figure out all the macros so this is the least it could pick up. And also, it was written like this because I saw a small dent in perf in the very original implementation But I believe it doesn't matter any more after all the crazy optimizations. |
|
Ah ha sorry, you wrote this code in the first place! I though it was lucab. The macros could probably be removed. When I first wrote that stuff I found a sizeable perf improvement from macros over generic functions. But I know Rust better now! Maybe could find a way to get rid of them now without hurting perf. Anyway, in my view, the byte handlers are fairly well optimized. If we want to get a significant gain, we'd probably need to look at one of:
So, in short, I think the cost in terms of our time is probably larger than the perf gains we're likely to get optimizing the byte handlers. My guess is that there's bigger gains to be got for less effort elsewhere. I brought it up here because I've noticed AI sometimes makes claims of better perf which aren't backed up by any evidence. In the absence of evidence, I think it may be better to take an "if it ain't broke, don't fix it" approach - something done for a reason by a reasonably-competent human in my view is probably a better bet than an unpredictable AI. Obviously, as the "code owner", I'm going to look at any changes to the lexer, and the cognitive load of assessing changes is a cost. |

No description provided.