I think the main reason of your code speed is not a language but its structure.
Are you assuming the code is optimalized already?
I'm not assuming that my code is fully optimalized.
I even know that i can gain performance by optimizing.
In my opinion the scripting language has no serious impact on speed as long as your script mainly focuses on DOM operations, which is very usually the case.
Indeed, no matter how quickly JS vs. AppleScript codes are interpreted and translated into InDesign DOM commands, execution time heavily depends on this common subsystem.
However, scripters have reported a few cases where the scripting language seems to matter. A well-known example is AppleScript's whose clause, which targets the DOM in a way that has no direct counterpart in JS. In such case, we can suppose that any JS-based workaround will run slower.
Now, what about non-DOM routines, such as processing huge array sorts, computing long strings, or operating on many floating-point numbers? That's an open question to me, as I have no skill in AppleScript. But my intuition leads me to believe that JS is a better choice for such tasks.
Thanks for the answer.
I'm going to try to rewrite a script with some non-DOM routines and do the test.
I have done the test with a slow script that adds a lot of data to a string variable. It is a Photoshop script and not Indesign, but I think that will make no real difference for this question.
Remember that an Applescript can also call shell scripts, OSAXen, and other applications when doing its work.