Skip to content

Commit

Permalink
refactor: improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-bahjati committed May 16, 2024
1 parent 5647ad0 commit 884ff7d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion program/c/src/oracle/model/price_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
#include "../util/avg.h" /* For avg_2_int64 */

/*
* In-place Heapsort implementation optimized for minimal compute unit usage in BPF.
* In-place bottom-up Heapsort implementation optimized for minimal compute unit usage in BPF.
*
* Initially it creates a max heap in linear time and then to get ascending
* order it swaps the root with the last element and then sifts down the root.
*
* The number of comparisions in average case is nlgn + O(1) and in worst case is
* 1.5nlgn + O(n).
*
* There are a lot of (j-1) or (j+1) math in the code which can be optimized by
* thinking of a as 1-based array. Fortunately, BPF compiler optimizes that for us.
*/
Expand Down

0 comments on commit 884ff7d

Please sign in to comment.