centfinance / Symmetric.PoolsUI

High quality liquidity pool and index fund. The link below is for the xDai development server.
https://pools-xdai.cent.finance
GNU General Public License v3.0
5 stars 6 forks source link

Improve performance of PoolsUI #75

Closed TheNewAutonomy closed 2 years ago

TheNewAutonomy commented 2 years ago

Presently, utils.ts contains inefficient code for calculating total liquidity where it walks through all pools on all supported networks to calculate total liquidity. This work is compounded since it repeats this calculation for each pool.

If there are 50 pools then it will walk through each of the 50 pools and for each, repeat the total liquidity calculation so it becomes 50 x 50 =2,500 calls. Actually that calculation only needs to run once and so it should be 50 calls to get the sum then use that result one for each of the pools so closer to 100 calls.