newscred / webhook-broker

This is a fully HTTP based Pub/Sub Broker with a goal to simplify system architecture in SOA or Microservice architecture. It aims to solve the inter service communication problem.
Apache License 2.0
18 stars 25 forks source link

AR-255 Use Heap Instead of List In the Priority Queue Implementation #134

Closed ImperishableMe closed 1 year ago

ImperishableMe commented 1 year ago

Ticket: https://jira.sso.episerver.net/browse/AR-255

This PR replaces the existing list based PriorityQueue implementation with a heap based one. It also adds test and benchmark for the corresponding changes.

Benchmarks

Machine Details

goos: linux goarch: amd64 cpu: AMD Ryzen 9 5900HS with Radeon Graphics

The results of running this benchmark function is as follows:

Before Using Heap:

Time (ns/op) Iteration Count Total Time (sec)
8028114944 20 169.928

After Using Heap:

Time (ns/op) Iteration Count Total Time (sec)
106319714 20 2.545
imyousuf commented 1 year ago

The outcome looks good in general; but I would restructure the commits a little bit differently; I would first add the priority queue test case and push that commit only to ensure all tests pass with it before we make changes. Then add rest of the change in the second commit. Can we kindly fix that?