!7 sS transpilerID = /*#1025804;*/ #759; p { S sRuns = second(args); int runs = 12; // 8 wasn't enough to fully compile for smaller sources if (isInteger(sRuns)) runs = parseInt(sRuns); bool mediumTranspile = !cic(args, "quick"); S snippetID = or2(first(args), #1016478); // transpile the OS by default S mainJava = //[[print("hello!");]]; //loadSnippet(#759); // doesn't work, requires different transpiler loadSnippet(snippetID); mainJava = dropTranslators(mainJava); S transpiled, transpiled2; new L times; bool resultsDiffer; maximizeConsole(); O transpiler = hotwireDependent(transpilerID); setAll(transpiler, /*useIndexedList2 := false, useTokenIndexedList := true,*/ dontLoadCachedIncludesFromVM := true, //cacheStdFunctions := false, //cacheStdClasses := false ); time "First run" { set(transpiler, +mainJava); setOpt(transpiler, mainSnippetID := snippetID); callMain(transpiler); transpiled = (S) get(transpiler, 'mainJava); } long time1 = lastTiming(); // Now we should have cached all the snippets, but not the pre-transpiled stuff. for (int run = 2; run <= runs; run++) { S msg = "Run " + run; if (run == runs) poorMansProfiling(); if (run == runs-1) call(transpiler, "clearSnippetCache"); time msg { if (mediumTranspile) call(transpiler, 'forgetCachedIncludes); set(transpiler, +mainJava); setOpt(transpiler, mainSnippetID := snippetID); callMain(transpiler); transpiled2 = (S) get(transpiler, 'mainJava); } times.add(lastTiming()); S check1 = minusLinesContaining("myTranspilationDate_value", transpiled); S check2 = minusLinesContaining("myTranspilationDate_value", transpiled2); if (neq(check1, check2)) { set resultsDiffer; print("WARNING: RESULTS DIFFER"); print(unidiff(check1, check2)); } } poorMansProfiling_stopAndPrintResults(); print("Made " + nChars(transpiled) + ", md5: " + md5(transpiled)); print("Run 1 with downloads: " + time1 + " ms"); int run = 2; for (long time : times) { print("Run " + run + " " + (run == runs-1 ? "with" : "w/o") + " downloads: " + time + " ms"); run++; } if (resultsDiffer) print("WARNING: RESULTS DIFFER BETWEEN RUNS"); }