-
Notifications
You must be signed in to change notification settings - Fork 9
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
Audit use of const& in interfaces #874
Comments
Should not use const& on any types <= 64bits, in general. Probably no loss in pref up to ~128bits. Numbers online indicate ~12bytes being some trade-off. YMMV on many factors. Compilers may also elect to ignore the const& in certain cases. MsgPtr etc. is small exception as it allows bypassing ref count management, eg. |
If possible, this should be detected automatically in CI. |
I wonder if we could use clang-tidy for that? Or at least for reporting the occurrences of such const refs. |
What Needs to be Done?
VT is very aggressive with using const& to pass small types...i.e. basic types around. It's extra overhead reading the code and might even slow it down because the compiler has to preserve the memory address. Switch these to just const?
The text was updated successfully, but these errors were encountered: