dcgtc / dgrants

Decentralized Grant platform that implements quadratic funding.
GNU Affero General Public License v3.0
84 stars 39 forks source link

DO NOT MERGE: benchmark PR #533

Closed thelostone-mc closed 2 years ago

thelostone-mc commented 2 years ago

Description

This does a comparison btwn alchemy + moralis

When suite is run 1 time SEE IMAGE

When suite is run 50 time SEE IMAGE

When suite is run 300 times over VPN in US SEE IMAGE

When suite is run over 500 times SEE IMAGE

Moralis seems to be better from what I can tell

Closes https://github.com/dcgtc/dgrants/issues/508 Closes https://github.com/dcgtc/dgrants/issues/487

apbendi commented 2 years ago

Here are my results running locally here in the US Atlantic, 50x:

Screen Shot 2021-11-29 at 10 31 56 AM

I'm not sure I see an obvious winner here. I'm re-running now with Infura and the default Polygon RPC.

One thing that jumps out is how long the code check takes. I wonder why we're doing that and if it could possibly be eliminated.

apbendi commented 2 years ago
Screen Shot 2021-11-29 at 11 19 02 AM
apbendi commented 2 years ago

Based on my initial runs, I think we can eliminate the default RPC and Infura. They're too far off the other two to be competitive.

It would be awesome if @gdixon and @mds1 could also try running this and posting your results, given your geographic locations. Perhaps it will give some clarity on the choice between Alchemy and Moralis. It's already configured to run with those two, 50x, so it should be as simple as pulling down this branch and navigating to /#/benchmark.

gdixon commented 2 years ago

Here are my results from the UK:

Screenshot 2021-11-30 at 03 43 07
mds1 commented 2 years ago

In stressCount I converted the for loop to await Promise.all(Array.from(Array(count).keys()).map(async (i) => { try/catch func })), so all the RPC requests are fired off in parallel. For some reason the UI wasn't reactive (which is why I didn't push it) so I just logged them out to the console. Results of 500 runs for Alchemy and 250 for Moralis (I think Moralis blocked me from sending that many requests at once because it'd fail with CORS errors)

Moralis

{
    "slowest": {
        "fetchCodeTime": 5518,
        "fetchAllGrantAndGrantRoundsTime": "64079.20",
        "fetchContributionsTime": "20621.40",
        "fetchGrantRoundTime": "56600.30",
        "fetchLastBlockNumberTime": "2038.70"
    },
    "fastest": {
        "fetchCodeTime": "2970.30",
        "fetchAllGrantAndGrantRoundsTime": "12316.10",
        "fetchContributionsTime": "18135.30",
        "fetchGrantRoundTime": "3575.40",
        "fetchLastBlockNumberTime": "845.10"
    },
    "avg": {
        "fetchCodeTimeAvg": "4029.41",
        "fetchAllGrantAndGrantRoundsTimeAvg": "53510.27",
        "fetchContributionsTimeAvg": "20013.68",
        "fetchGrantRoundTimesAvg": "14880.15",
        "fetchLastBlockNumberTimesAvg": "1346.02"
    },
    "median": {
        "fetchCodeTimeMedian": 3995.300000000745,
        "fetchAllGrantAndGrantRoundsTimeMedian": "63716.20",
        "fetchContributionsTimeMedian": "20423.15",
        "fetchGrantRoundTimeMedian": "5425.95",
        "fetchLastBlockNumberTimeMedian": "1339.30"
    }
}

Alchemy

{
  "slowest": {
      "fetchCodeTime": 10589.19999999553,
      "fetchAllGrantAndGrantRoundsTime": "119997.90",
      "fetchContributionsTime": "37854.70",
      "fetchGrantRoundTime": "44177.80",
      "fetchLastBlockNumberTime": "4073.70"
  },
  "fastest": {
      "fetchCodeTime": "5889.20",
      "fetchAllGrantAndGrantRoundsTime": "81734.40",
      "fetchContributionsTime": "4204.20",
      "fetchGrantRoundTime": "12759.20",
      "fetchLastBlockNumberTime": "1038.20"
  },
  "avg": {
      "fetchCodeTimeAvg": "7731.22",
      "fetchAllGrantAndGrantRoundsTimeAvg": "103870.10",
      "fetchContributionsTimeAvg": "33165.95",
      "fetchGrantRoundTimesAvg": "26669.76",
      "fetchLastBlockNumberTimesAvg": "2460.72"
  },
  "median": {
      "fetchCodeTimeMedian": 7476.550000000745,
      "fetchAllGrantAndGrantRoundsTimeMedian": "112246.85",
      "fetchContributionsTimeMedian": "37433.55",
      "fetchGrantRoundTimeMedian": "26156.05",
      "fetchLastBlockNumberTimeMedian": "2606.95"
  }
}
apbendi commented 2 years ago

Awesome! Thanks @gdixon and @mds1. With these results, it feels like Moralis has taken a clear lead. Any objections to going that route? cc @thelostone-mc

mds1 commented 2 years ago

Fine with me!