As we have previously mentioned, in chapter 2 of the "Development in Salesforce Marketing Cloud" series, within the advantages and disadvantages of both languages is the issue of the performance of each one.
If the difference were slight, it would be a negligible variable, unless the data handling is immense, both in the number of records and related tables that are used to personalize emails, cloud pages, etc.
Finally, we show you some numbers. These won't matter if you use little data; because in many cases, and today when going to smaller niches, this amount of data is limited. But in some of our clients with huge amounts of data, it is a factor to take into account when both languages meet the desired objective.
Should we use one language or another depending on its performance?
As we will see, and given the performance differences between one and the other, the answer, if you use a lot of data, maybe YES.
The test carried out is very basic but conclusive, we have used typical data tasks to analyze this performance.
A loop with text printing on each iteration.
Just a loop, without printing data or doing any other operation.
A data retrieval from a Data Extension and its printing in a table (50 rows).
A loop with a GET call to a page (5 requests).
And a test of doing 500 inserts in a Data Extension with 6 fields.
The results are very striking: the difference is very big in some tasks, mostly to the detriment of SSJS (bad news for those of us who prefer this language) and curiously the biggest difference is an elementary loop to print a text; but in the rest, there are also differences, it only wins if it is a loop without text, something that is not very common either (the truth is).
Here is the table of results:
|COMPARISON OF EXECUTION TIME IN SECONDS: AMPSCRIPT VERSUS SSJS
|Printing in a loop of 5000 iterations of a String
|20000 iteration loop without printing
|Lookup and printing of 50 rows of a Data Extension
|HTTP get to a URL in a loop 5 calls
|500 data inserts in a DE
And here is a table, representing the greater or lesser slowness of one language versus the other.
We hope these data give you some light. They have helped us decide in each development because we prioritized SSJS more than we should and now we will take AMPSCRIPT more into account in certain jobs.
If you liked this article, you may also be interested in: