Cache calculated values in table to avoid calculation slowness?

I have an app with a substantial amount of calculations that is hard to avoid, and as such is getting really slow. The calculations though don’t need to occur every time, as they generate a score that only changes when the scoring criteria changes.

Has anyone ever built an app where you had calculations, and cached or stored them in another table which is ultimately what the end user will look at?

For example, say I have 1000 rows calculating a score. These rows will calculate every time a user opens the app right now. I would like to instead have a separate table with the same info (i.e. name, email, other user info) plus the score, but have the score be static (i.e. a non calculated number field). The user gets views from this table and thus the app runs much faster as it doesn’t need to recalculate the scores. If a user decides to change the scoring criteria, then the scores recalculate for all 1000 rows, and the new scores are copied into the static table.

Has anyone tried to do anything like this? any help is welcomed!

Theoretically, you can store a set of inputs and its corresponding output, then match the user’s input with those rows and if there’s a match, show the stored output.

However, I wonder if your approach is optimized. Why would you need 1000 rows to calculate the score? Are you using Glide Tables or something else?

Thanks for the response. In this scenario, there is 1000 different scores actually. Each row is getting an individual score.

I’m using sheets as the base for about half of the table right now in my app

And you’re doing the score calculation in the Sheets as well? I think you should move as much logic to Glide as possible to enhance performance.

All logic is done in Glide right now. Only raw values are stored in sheets.

Any thoughts on how to better avoid running the calculations every time the user signs in or does something unrelated?

Do they have to see the rows you mention though? Without knowing more about your structure, I think you can just apply row owners to that table so people do only need to download their own data, if they’re signing in?