nuclear icon indicating copy to clipboard operation
nuclear copied to clipboard

Memoize request results wherever possible

Open nukeop opened this issue 5 years ago • 8 comments
trafficstars

In many cases we could benefit from memoizing stuff like search results from various services to minimize rate limiting and speed up repetitive searches. I plan to do that in the near future but if anyone wants to contribute, even a simple proof of concept in one action would be valuable.

nukeop avatar Jan 23 '20 00:01 nukeop

Hi, My partner @nfeygin and I would like to work on this if possible

alizeh12 avatar Apr 04 '20 00:04 alizeh12

Okay, if you decide to work on this, let me know which parts are good candidates for memoizing.

nukeop avatar Apr 04 '20 22:04 nukeop

sure

alizeh12 avatar Apr 06 '20 15:04 alizeh12

Hi ! can you please guide me from where should I start on working this ?

devanshim2207 avatar Jun 06 '21 08:06 devanshim2207

A good place to do this would be here: https://github.com/nukeop/nuclear/blob/master/packages/app/app/actions/search.ts

These thunks fire requests to various services, and the functions that do the requests could memoize results for a given set of search parameters.

nukeop avatar Jun 07 '21 07:06 nukeop

which database have you used ?

devanshim2207 avatar Jun 07 '21 15:06 devanshim2207

You 've used this in line 27-> updateSearchHistory: createAction(Search.UPDATE_SEARCH_HISTORY, (searchHistory: string[]) => searchHistory

what's this function for?

devanshim2207 avatar Jun 07 '21 16:06 devanshim2207

We use Redux for storing search data, I don't want to memoize database access since that would be pretty pointless.

updateSearchHistory stores the last 5 search queries so we can show them as suggestions in the search bar, it's irrelevant for this task.

nukeop avatar Jun 07 '21 16:06 nukeop