Hexworks / mixite

A GUI agnostic hexagonal grid library. Supports a multitude of grid layouts including hexagonal, triangular, rectangular and more.
Apache License 2.0
191 stars 31 forks source link

Minor perf items #50

Closed drekbour closed 4 years ago

drekbour commented 4 years ago

All open for discussion. There are many more changes on my local to follow these so stick to what is here rather than what isn't!

Q: I don't know how to default the centreX to centre.coordinateX because it is a property not a method). Can we just delete them (did they ever get published in this form?)

drekbour commented 4 years ago

Have added some performance numbers; Below are basically before and after this PR. I have not changed any method names or nullable types yet.

Test, Before, After
HexagonalGridBuilderPerfTest.buildTime-RECTANGULAR, 4198, 5012
HexagonalGridBuilderPerfTest.buildTime-HEXAGONAL, 3266, 4108
HexagonalGridBuilderPerfTest.buildTime-TRIANGULAR, 4183, 4463
HexagonalGridBuilderPerfTest.buildTime-TRAPEZOID, 4551, 5090

HexagonalGridCalculatorPerfTest.calculateMovementRangeFrom, 148438, 172944
HexagonalGridCalculatorPerfTest.drawLine, 232930, 254664
HexagonalGridPerfTest.getNeighborsOf, 454140, 545758
HexagonalGridPerfTest.getByPixelCoordinate100pct, 1593, 3157
HexagonalGridPerfTest.getByPixelCoordinate50pct, 2561, 4910
HexagonalGridPerfTest.iterateHexagons, 300, 314
HexagonalGridPerfTest.getHexagonsByCubeRange, 154, 340
HexagonalGridPerfTest.getHexagonsByOffsetRange, 127, 333
drekbour commented 4 years ago

perf-results.zip