public void testParallelComplexNoExecutor() throws MustacheException, IOException { if (skip()) return; System.out.println("complex.html evaluations per millisecond:"); for (int i = 0; i < 3; i++) { { MustacheFactory cf = createMustacheFactory(); Mustache m = cf.compile("complex.html"); complextest(m, new ParallelComplexObject()).toString(); long start = System.currentTimeMillis(); int total = 0; while (true) { complextest(m, new ParallelComplexObject()); total++; if (System.currentTimeMillis() - start > TIME) break; } System.out.println("Serial with callable: " + total / TIME); } } }
public void testParallelComplex() throws MustacheException, IOException { if (skip()) return; System.out.println("complex.html evaluations per millisecond:"); for (int i = 0; i < 3; i++) { { DefaultMustacheFactory cf = createMustacheFactory(); cf.setExecutorService(Executors.newCachedThreadPool()); Mustache m = cf.compile("complex.html"); complextest(m, new ParallelComplexObject()).toString(); long start = System.currentTimeMillis(); int total = 0; while (true) { complextest(m, new ParallelComplexObject()); total++; if (System.currentTimeMillis() - start > TIME) break; } System.out.println("Parallel: " + total / TIME); } } }
public void testSerialCallable() throws MustacheException, IOException { StringWriter sw = execute("complex.html", new ParallelComplexObject()); assertEquals(getContents(root, "complex.txt"), sw.toString()); }
public void testComplexParallel() throws MustacheException, IOException { MustacheFactory c = initParallel(); Mustache m = c.compile("complex.html"); StringWriter sw = new StringWriter(); m.execute(sw, new ParallelComplexObject()).close(); assertEquals(getContents(root, "complex.txt"), sw.toString()); }