-
Notifications
You must be signed in to change notification settings - Fork 334
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
Micro-optimizations for base_wire_entity #3192
Conversation
function ENT:Think() | ||
if (CurTime() >= (self.NextRBUpdate or 0)) then | ||
local tab = self:GetTable() | ||
|
||
if (CurTime() >= (tab.NextRBUpdate or 0)) then | ||
-- We periodically update the render bounds every 10 seconds - the | ||
-- reasons why are mostly anecdotal, but in some circumstances | ||
-- entities might 'forget' their renderbounds. Nobody really knows | ||
-- if this is still needed or not. | ||
self.NextRBUpdate = CurTime() + 10 | ||
tab.NextRBUpdate = CurTime() + 10 | ||
Wire_UpdateRenderBounds(self) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to investigate if this is even needed code anymore
Co-authored-by: thegrb93 <grbrown93@sbcglobal.net>
I don’t understand why cancel all optimizations for :GetTable. It’s not part of the ENTITY metatable and can be used safely. I also don’t see the point in removing vector optimizations, as all they do is prevent creating new vectors. |
Crap code for a pinch of performance. Entity __index does GetTable itself so its not that beneficial in places where you're only avoiding one __index call |
I was also questioning if |
Basically just saves __index calls/caches colors