So I have this document.
It has several big formulas, including one formula that generates a complex HTML report getting related results from several different tables and calculating them. And another widget reads it. The HTML formula repeats for every row of the main table, and has almost 300 lines of code.
So I decided to see if I could optimize this with the Custom Widget Builder.
I DUPLICATED the document. Deleted that formula column and replaced by a formula with 190 rows, which while still large, has 100 rows less than the previous. It fetches the data from related tables and builds a JSON
Then the Custom Widget Builder connects to THAT formula and displays a report just like the previous one. This way, I remove basically 100 lines of code from each row of the main table, that were responsible for formatting the report. Now the formatting goes into the Custom Widget Builder while the formula just gets the raw data from related tables and does brute calculation.
So, now I wanted to test both documents in the Formula TIMER, to see if there was indeed a performance improvement.
the results from the old document… the HTML_av is the formula that I replaced
but the new document…
“Loading Time Data. Don´t close this tab.”
and then, back to page 1
OK, RESTARTING THE ENGINE FIXED IT
For anyone curious about the results
Old Document
Empresa html_av 0,2904908657 17 0,017087698 0,0388391018
New Document
Empresa ProcessedResults 0,2736773491 17 0,0160986676 0,042154789
Not much improvement
Edit 2… avoided any calculation in the Grist formula. Now it just fetches all related data. The calculations are all performed by the widget.
Grist timer for the formula reduced 10 times! From 0.27 seconds to 0.02 seconds!!! YAY!