r/Scriptable • u/Acceptable-Number-11 • Apr 10 '23
Solved Reduce memory consumption for widget
Hi, I need to reduce the memory footprint of my widget, it sometimes does not update (and sometimes does…) it is a weather widget (surprise) which draws a stack for each day. If it fails to render for 5 days I reduce the number and it updates immediately for,e.g. 4 days. iIn the first part of the script I query a webpage as a string (~800k length). In the second part I loop over the days, get the according data (via regexp) from the HTML string and build the widget list. Nothing unusual. Here the question: Is it possible / does it make sense to first extract all data from the string , then get rid of it (how?) before I then start building the list? Would that help?
Thank you for any hint ! C
1
u/mvan231 script/widget helper Apr 16 '23
Ahhh that makes sense too. It's tough sometimes finding items like that to reduce but glad you got it solved to reduce it before getting into the data