-
Notifications
You must be signed in to change notification settings - Fork 255
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
Add compact attribute for hot classes #289
base: master
Are you sure you want to change the base?
Conversation
Sorry, but micro-optimizations are out of scope of this project. You could see that other implementation are not optimized too, but rather represent the idiomatic code (as we don't compare algorithm implementations, but rather compilers/interpretators operating the similar algorithms). It's fine to submit another test that has optimizations though. Please note that other implementations (including this one) may contain some non-idiomatic code and some code optimizations, we try to fix those discrepancies, but could miss something. |
Doesn't this mean that you should disable JIT compiler warm-up? |
I am not really againts adding inline/compact for vala or for others (because it can be considered as also idiomatic way for speedup programs, not hacks). Like java for example using |
Compact classes doesnt support private modifier yet. There will be compile error |
@gavr123456789 We don't have JIT compiler warm-ups anymore, if you've noticed some, please let me know. |
btw, i think that disable index checks (that nim -d:danger doing), is much more hack, than inline. |
I have nothing to add except that I agree with @kostya. This is not changing the algorithm to make it work faster, it is a common thing that vala programmers will do if they write an algorithm rather than a GUI, but this may not be obvious to C# programmer. |
So the discussion is over? |
@gavr123456789 Compact classes do not look like idiomatic data type (considering their limitations), and looks like are used for the use-cases there specific memory management is required:
Using them for the performance tuning does look like a hack for me. That would be like using structs and global functions to operate them in OOP way in C++ - while it make sense in some use-cases, it's not an idiomatic type of working with classes in C++. @kostya |
I not sure about final, but seems it used for internal optimizations also. About compile keys i think we should use, only keys which would use in production, i doubt that |
@kostya Added #290 issue to address it. As for |
Vala lost 10 seconds, which at first surprised me, then I looked in db679b0 and after experiments, I found that the reason was private fields. I created an issue https://gitlab.gnome.org/GNOME/vala/-/issues/1116.
The maintainer of the language recommends the use of a Compact classes in high loaded code. Also Vala supports inline modifier, so I added it on hot methods too.