-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Speed up hit tests for points and markers
If the range tree returns multiple points or markers that might be within the search area, we were sorting them to maintain a stable response order. Javascript sort defaults to a lexical sort which casts all values to strings, so we had been doing `points.sort((a, b) => a - b)` to do a numerical sort, but this has a lot of function call overhead and probably is casting each value between strings and numeric datatypes. Instead, we do `points = Uint32Array.from(points).sort();` which uses native javascript functions and is much faster.
- Loading branch information
Showing
2 changed files
with
13 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters