fix: Cleans up Point checks and removes statics (#966)

- [X] Removes static freezing/unfreezing. Use other tools for this.
- [X] Cleans up IPoint3D allocations
- [X] Removes IPoint3D constructors since the compiler may not optimize the constructor path and allow allocations.


Note: Instead of `new Point3D(m)`, do something like `new Point3D(m.Location)`. Sorry for the inconvenience. In the long run this will prevent abuse of hot paths that will cause performance issues.
This commit is contained in:
Kamron Batman 2022-03-20 23:15:59 -07:00 committed by GitHub
parent 23532db603
commit 0925a2d435
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 184 additions and 958 deletions

View file

@ -47,7 +47,7 @@ namespace Server
m_Y = y;
}
public Point2D(IPoint2D p) : this(p.X, p.Y)
public Point2D(Point2D p) : this(p.X, p.Y)
{
}

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Runtime.CompilerServices;
namespace Server
{
@ -49,11 +50,16 @@ namespace Server
set => m_Z = value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Point3D(IPoint3D p) : this(p.X, p.Y, p.Z)
{
}
public Point3D(IPoint2D p, int z) : this(p.X, p.Y, z)
public Point3D(Point3D p) : this(p.X, p.Y, p.Z)
{
}
public Point3D(Point2D p, int z) : this(p.X, p.Y, z)
{
}