mirror of
https://github.com/parnic/advent-of-code-2022.git
synced 2025-06-16 13:40:13 -05:00
Quick perf improvement
Day 15 part 2 is now ~300ms on my PC with my dataset in Release (~1s in Debug, which is...striking).
This commit is contained in:
@ -37,7 +37,7 @@ public struct ivec2 : IEquatable<ivec2>, IComparable<ivec2>, IComparable
|
|||||||
public float Length => MathF.Sqrt(LengthSquared);
|
public float Length => MathF.Sqrt(LengthSquared);
|
||||||
|
|
||||||
public int ManhattanDistance => Abs(this).Sum;
|
public int ManhattanDistance => Abs(this).Sum;
|
||||||
public int ManhattanDistanceTo(ivec2 other) => (this - other).ManhattanDistance;
|
public int ManhattanDistanceTo(ivec2 other) => System.Math.Abs(x - other.x) + System.Math.Abs(y - other.y);
|
||||||
|
|
||||||
public ivec2 GetBestDirectionTo(ivec2 p)
|
public ivec2 GetBestDirectionTo(ivec2 p)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user