Skip to content

Conversation

@Astralcircle
Copy link
Contributor

Basically just saves __index calls/caches colors

Comment on lines 287 to 298
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
Copy link
Contributor

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>
@Astralcircle
Copy link
Contributor Author

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.

@thegrb93
Copy link
Contributor

thegrb93 commented Dec 1, 2024

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

@Denneisk
Copy link
Member

Denneisk commented Dec 2, 2024

I was also questioning if GetTable in this usage was efficient but I assumed the best. With that said, some of these index calls are ran every tick (conditionally), and I think there's merit in having these changes there.

@thegrb93 thegrb93 merged commit a722233 into wiremod:master Dec 3, 2024
1 check failed
@Astralcircle Astralcircle deleted the basewire branch December 3, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants