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
Minor performance tweaks #8048
Minor performance tweaks #8048
Conversation
Sorry I haven't had time to plugin some measuring tools. Without that, it's difficult to see how good a change is. Do you know the first rule of optimisation? 😆 In your PR, for example, I bet you a beer that your changes of Of your porposed changes, I like the one to If you want to help with #8022 it would be awesome. I'll try to get a basic tool for measurement, but there's already a benchmarking task you can use, since you know which cops to attack. Those cops should get at least an order of magnitude faster. Many of them seem to rely on analyzing the tokens for whitespace and all... |
I have not tested these changes with any kind of profiler, so it is possible that they don't make any kind of impact. I've made changes similar to that in What is your reasoning for believing changing In the past, I have relied on |
First, But even assuming there was no additional checking, it's not possible for That's the very best case scenario, which would requires the implementation to use You just can't beat an attribute call (super optimized) + builtin Even if you avoided creating an intermediate array (which you can't here), it is typically not faster. It's a bit frustrating, but yielding from Ruby code is actually a bit slow. When optimizing Parser's As for any talk about optimization: this is theoretical, as unless someone changes the
|
bf71c82
to
11ffad4
Compare
11ffad4
to
4da5ea1
Compare
Thanks for providing the feedback. There were some aspects of the change that I had not considered before. You are absolutely correct about It looks like there are several places in the code that could be changed to replace There are a couple of small changes in here that I think still could be good. Overall, they are rather small. I still need to actually test the performance diff. |
This is somewhat related to #8022. I decided to briefly look over some of the potential performance issues. I don't think anything in here is going to radically improve performance. It mostly seemed like low hanging fruit to avoid an extra allocation.