
Billy Rennekamp
@okwme
127 Following
258 Followers
Released a standalone version of @trifle/leaderboard, our new leaderboard Solidity library đ
For on-chain games, tracking top scores is more challenging than it seems. Traditional sorting methods can be too slow, often running with O(n^2) complexity, which is impractical for large sets of players due to high gas costs. To optimize performance, we implemented a self-balancing binary search tree, achieving O(log(n)) complexity for key operations like insertions and deletions.
Initially, we adapted the balanced binary tree from Rob Hitchens of B9Labs, building on foundations laid by bokkypoobah's tree. However, we faced issues with FIFO ordering in tie situations. After several enhancements, we developed a new approach that effectively handles ties without workarounds, now available at https://github.com/trifle-life/leaderboard.
Try it out and let us know if it helps! If you're interested in contributing, PRs are welcome đˇââī¸ 1 reply
1 recast
1 reaction
0 reply
0 recast
1 reaction
0 reply
0 recast
3 reactions
9 replies
0 recast
1 reaction
2 replies
0 recast
0 reaction
0 reply
1 recast
0 reaction
1 reply
0 recast
0 reaction
0 reply
0 recast
0 reaction
3 replies
0 recast
1 reaction
3 replies
0 recast
0 reaction
1 reply
0 recast
0 reaction
0 reply
0 recast
0 reaction
1 reply
0 recast
0 reaction
0 reply
0 recast
1 reaction
1 reply
0 recast
0 reaction
1 reply
0 recast
1 reaction
0 reply
0 recast
0 reaction
0 reply
0 recast
0 reaction
0 reply
0 recast
0 reaction
1 reply
0 recast
0 reaction