# 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");
    			}

Parent topic: Optimization and Performance Profiling