r/GoogleAppsScript • u/c_for • Jun 07 '19
Just how large a script can a write while maintaining reliability?
This is my first script and i've only been coding for a month. At this point i'm at 600 lines of code and 4 HTML sidebars attached to a google sheet. It is fully functional and reliable. I'm somewhat obsessive and have really dived head first into coding.
Does the size of the code and html files increase the amount of time it takes your menus to populate and become usable?
I'm at 600 lines of code now. How much can I write before stability becomes a factor. I have big plans and much more to write.
I'm loving coding. I haven't played computer games since I started. This is incredible. I wish I had tried this sooner.
2
u/ppc-hero Jun 08 '19 edited Jun 08 '19
Ive written ads scripts over 20k lines, some of them run every hour on $100k/month accounts.
The amount or length of code has nothing to do with speed or stability. The content of the code does.
The same goes for the editor interface. Length of the code has no detectable effect on the rendering, or the stability of the editor.
For readability, you can split your code into several files (left hand side of the editor shows you the files). Make sure to comment and structure responsibly.
1
u/c_for Jun 08 '19
For readability, you can split your code into several files
Oh!!!!! That is great. I'll look into that. Once I got to about 300 lines I became more careful about using the code more efficiently. The 'programming like a grown up' video from the 'Learn Google Spreadsheets' youtube channel really helped. But at this point it is becoming more of a task to scroll around the page. That should help a lot.
2
u/AndroidMasterZ Jun 07 '19 edited Jun 08 '19
I'm not sure about the line limit(heard it's 10mb/file (or 50mb), I'm not certainIt's 10 mb/project[Around 700k lines]).You can split up the code into individual js files. Size of code is probably inversely proportional to speed, but the effect should be negligible, provided the code is well compartmentalized and follows best practices.