Timing code ('shootout'):

The code below will run a BO Update 100 times and report the amount of time taken. Note the 5 "warmup" executions before the repeated 100 runs.

             public void testMultiplePluginScripts() throws Exception {
                 String docString1 = "<DR_​ShortCreateIntervalRecords><factId>219250542869</factId><longDescr>REEE</longDescr></DR_​ShortCreateIntervalRecords>";
                 Document doc1 = DocumentHelper.parseText(docString1);
         
                 String docString2 = "<DR_​ShortCreateIntervalRecords2><factId>219250542869</factId><longDescr>REEE</longDescr></DR_​ShortCreateIntervalRecords2>";
                 Document doc2 = DocumentHelper.parseText(docString2);
         
                 // warmups
                 for (int i = 0; i < 5; i++) {
                     BusinessObjectDispatcher.execute(doc1, BusinessObjectActionLookup.constants.FAST_​UPDATE);
                     rollbackAndContinue();
                     BusinessObjectDispatcher.execute(doc2, BusinessObjectActionLookup.constants.FAST_​UPDATE);
                     rollbackAndContinue();
                 }
         
                 long totalElapsed = 0;
                 // speed
                 for (int i = 0; i < 100; i++) {
                     long start = System.nanoTime();
                     BusinessObjectDispatcher.execute(doc1, BusinessObjectActionLookup.constants.FAST_​UPDATE);
                     flush();
                     totalElapsed += System.nanoTime() - start;
                     rollbackAndContinue();
                 }
                 System.out.println("Script (100): " + totalElapsed / 1000000 + "ms");
         
                 totalElapsed = 0;
                 for (int i = 0; i < 100; i++) {
                     long start = System.nanoTime();
                     BusinessObjectDispatcher.execute(doc2, BusinessObjectActionLookup.constants.FAST_​UPDATE);
                     flush();
                     totalElapsed += System.nanoTime() - start;
                     rollbackAndContinue();
                 }
                 System.out.println("Java (100): " + totalElapsed / 1000000 + "ms");
         }