KlimaDAO / klimadao

Monorepo for the official KlimaDAO site, dApp, components and design system.
https://klimadao.finance
MIT License
95 stars 73 forks source link

[performance] Improvement for /projects page #2260

Open sidneyarida opened 9 months ago

sidneyarida commented 9 months ago

What: A_brief_description_of_what_is_involved_in_the_change

Improvement that can be made to speed up the loading of the /projects page

1) Project endpoint is being called on server side for pre-rendering but not used after. Later the projects endpoint is called again by the components for generating the list Doing a test passing the projects array on the page component make a pretty big difference making rendering the page immediately without the loading spinner after when the components are trying to rerender the projects

2) avoid calling /projects endpoint when changing sort or layout parameter because sorting is done client side and changing layout doesn't effect the results

Time benchmark for each consuming function

/projects [1] getDefaultQueryArgs: 839.732ms [1] marketplace.getProjects: 573.49ms [1] digital_carbon.findDigitalCarbonProjects: 1.455s [1] fetchAllCarbonProjects: 179.148ms [1] fetchAllPoolPrices: 253.614ms [1] composeProjectEntries: 28.918ms [1] total time: 3.337s

Why: A_brief_description_as_to_why_this_change_is_needed

How: Any_design_details_or_links

Expected Outcome:

Testing Criteria:

do_something do_something_else expect_something