I have an automation composed of 4 “update records”, 4 “scripts” and 1 “create record” modules.
Each time I update the scripts, the page freezes for a few seconds as if a static analyzer was analyzing the whole code.
My scripts are 40, 500, 40 and 20 lines long.
I also have about 20 parameters in total.
There are also conditional actions
If someone has a clue about the origin of these slowness and advices to reduce them, I’m interested :slightly_smiling_face:
Welcome to the Airtable community!
Is the script freezing when you are typing in the code editor or when you do a test run?
The editor itself is continually analyzing your code as you type. That is how it is able to give hints and flag potential errors.
When doing a test run, I find that automation scripts sometimes seem slow. You can see the actual length of time the script took in the script output section on the right.
How long a script takes to run depends more on the logic of the script than the number of lines. For example, if you await an async function call inside a loop, it’s going to take a while.
I did not specify but the slowness appears when I type text in the scripts. It’s quite annoying to wait ~1 second for each added character :slightly_smiling_face:
I have no problem concerning the execution of these scripts.
Perhaps that the number of parameters given to the scripts is a hard challenge for the analyzer.
I will try to reduce them and mesure the impact on the performance.
I found myself annoyed by the same behavior a while ago.
Besides just writing cleaner code, I like to write my code in VS code and then just paste it directly into Airtable to run, debug, and test.
I keep the two open side-by-side for cases where I want to save myself the effort of trying to remember a field name, table, etc.
I don’t write in VS code exclusively because of that though, but it’s an added advantage.
Ugh. That isn’t just annoying. That makes it impossible to be productive.
Did reducing the input variables help? How about ensuring that the input variables all have reasonable values in the triggering record? Twenty input variables seems like a lot to me. I rarely have more than half a dozen. If I need more record values, I tend to have the script retrieve them directly versus through input variables.
Hopefully it was a random fluke, but if you are still experiencing this issue, you should make a video recording and send it to Airtable support.