Download Jar. Libraryless. Click here for Pure Java version (12300L/78K).
!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<Long> 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"); }
download show line numbers debug dex old transpilations
Travelled to 11 computer(s): bhatertpkbcr, jcllbfdqhrgy, mqqgnosmbjvj, omdjrrnzbjjv, pyentgdyhuwx, pzhvpgtvlbxg, snaazhdonpnp, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1025501 |
Snippet name: | Benchmark & Profile Transpiler |
Eternal ID of this version: | #1025501/41 |
Text MD5: | 0bb866c9f45a703911c77603547cfdd7 |
Transpilation MD5: | ebeebefed0ff29bd3db420c0903f00d8 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-01 20:21:56 |
Source code size: | 2400 bytes / 76 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 427 / 1868 |
Version history: | 40 change(s) |
Referenced in: | [show references] |