The scripts I have now use data merge fields to create variable PDF / JPG files with an indesign template. The slow lines of the code are
if there are any other hints on how to speed this up I would appreciate it. For a seven page PDF with around twenty seven variable fields it is taking around 2 seconds to generate a single document.
Problem is in any cases, InDesign will take time to open the template possibly export and close. So without you having done anything you can count on 1 second to process. Then you can add your process and an extra second. I mean you have uncompressable time here.
I am having same issue with PDF export i wish I can speed up but when it comes to InDesign inner processes, it's likely that c++ will be definitively quicker but i's out of my scope.
Depending on your project and the need of InDesign special features, you may consider alternative datamerge tools.
The non-jsx languages have their gains when it comes to general processing like math commands and extra functionality.
Where the COM method is just calling the exact same DOM function as jsx then you won't see a big difference.
If your looking to export thumbnails from the metadata then the non jsx has very big time advantages