[SPIGOT-1384] Entity#a(AxisAlignedBB) creates new object Created: 31/Dec/15 Updated: 06/Feb/22 |
|
Status: | In Progress |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Michael Zangl | Assignee: | md_5 |
Resolution: | Unresolved | Votes: | 1 |
Labels: | Craftbukkit |
Attachments: |
![]() |
Description |
Entity#a(AxisAlignedBB) attempts to fix the AABB given to it. This forces the cretaion of a new AABB every time the method is invoked (which is quite often). This patch skips many AABB allocations on my test server and reduced their allocation count by 16% (many entities on that server) public void a(AxisAlignedBB axisalignedbb) { else { this.boundingBox = axisalignedbb; } // Changes end // Changes start - block invalid bounding boxes private double clamp(double d, double min, double max) { if (d < min) return min; if (d > max) return max; return d; }// Changes end |
Comments |
Comment by RyanTheLeach [ 06/Feb/22 ] |
without performance profiling this could probably be closed.
My best guess for what this method is (in 2022) is that it was named SetBoundingBox
I don't think that making a defensive copy, with some sanity checks is that big of a deal. |
Comment by md_5 [ 03/Jan/16 ] |
CLA as per other tickets. |