Skip to content

Micro-optimizations (16-21% performance improvement across the board)

Compare
Choose a tag to compare
@Z-Kris Z-Kris released this 31 Dec 02:02
· 13 commits to master since this release
  • revert latest change of trying to cut down on array resets, as the overhead this causes with its checks outweighs the benefit
  • remove dumb pathfinder
  • remove extraFlagToCheck argument
  • remove defaultFlag argument
  • combine validLocalX and validLocalY arrays into one
  • remove unnecessary bitwise checks in getZoneIndex
    Update version to 2.3.0

Results:
(initial, before any commits from today)

Durations: 
Short path: 2.566241001s
Medium path: 744.876900ms
Long path: 296.284801ms
Invalid path: 380.979400ms

Latest

Durations: 
Short path: 2.007796300s
Medium path: 590.569600ms
Long path: 248.614ms
Invalid path: 317.780799ms

Gains:
Short: -21.761194711735495%
Medium: -20.715812236894436%
Long: -16.08951955655667%
Invalid: -16.588456226242155%

Note: The test consisted of 100k short paths, 10k medium paths, 1k long and 1k invalid paths. All the paths started from the same coordinate. This was all singlethreaded, and the fifth consecutive results were taken both times.