When talking about User Event scripts, does it mak...
# suitescript
j
When talking about User Event scripts, does it make a difference how many scripts are involved in making my User Event script processes happen? For instance, if I’ve got a bunch of different processes that happen upon saving of an item that all have to do with item that, but have different applications that this data is used in. Is there an advantage from a performance standpoint to having them all in separate SS files? It seems more organized to split each piece into it’s own file for better file organization, but I don’t know if that has a negative impact on performance…
b
multiple files are fine, multiple scripts will hurt performance
e
I’ve never benchmarked it, but I would bet that having them in one file is probably faster. But, that doesn’t necessarily mean it’s wrong.
e
In fact at SuiteWorld 2021 there was a session on how to consolidate your scripts to effect a 30% performance improvement.
s
Even if the I'm just importing a bunch of custom module from 4 different files but only one executed script ?
b
the general theory is that its easier to read one file over a bunch of smaller files
however you probably wont be able to measure it, the benefits are small, the code you write to measure performance will probably cost more than the benefits
if you really cared, you would use one of the many bundling and minifying tools available for javascript
there are lots because there are real benefits to large single files when the browser has to retrieve the code over the internet
s
I hear but then you code won't be dry , that custom module is used in many files
Is that one of benefits of we pack it is compiled into one file