forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
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 (f…
…acebookincubator#11955) Summary: Pull Request resolved: facebookincubator#11955 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`). Reviewed By: xiaoxmeng Differential Revision: D67626564 fbshipit-source-id: 8d3543f1b877a134f7c4be5c4405cfc44f90c660
- Loading branch information
1 parent
3515044
commit f4ac9dd
Showing
8 changed files
with
370 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
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.