-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Optimize IndexedPriorityQueue::addOrUpdate 20 times faster
Summary: Optimize `IndexedPriorityQueue` to use more compact data structures (binary heap) to leverage cache locality and avoid unnecessary memory allocations. `addOrUpdate` is now about 20 times faster for large data (~1 million elements). This allows us to replace the custom heap implementation in `ApproxMostFrequentStreamSummary` with `IndexedPriorityQueue`. Note that `pop` becomes about twice slower in the new version. This is expected because we shift some of the reordering cost from insertion time to pop time. This shall be good because for each `pop`, we have at least one corresponding `addOrUpdate` which guarantees net performance gain, and in most of the case we do not even have `pop` on critical path (e.g. in case of `ApproxMostFrequentStreamSummary`). Differential Revision: D67626564
- Loading branch information
1 parent
8ebd3a8
commit a37c7ce
Showing
7 changed files
with
351 additions
and
318 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
Oops, something went wrong.