From a57340adb7f54b6c4dd12a276ec5c21c25fe8164 Mon Sep 17 00:00:00 2001 From: rhinemann Date: Mon, 11 Mar 2024 12:43:52 +0200 Subject: [PATCH] Initial commit --- C/Makefile | 6 + C/code_cycle | Bin 0 -> 16616 bytes C/code_cycle.c | 27 + C/code_unoptimised | Bin 0 -> 16712 bytes C/code_unoptimised.c | 33 ++ Go/code_cycle/go.mod | 3 + Go/code_cycle/main.go | 24 + Go/code_unoptimised/go.mod | 3 + Go/code_unoptimised/main.go | 29 + Java/Makefile | 6 + Java/code_cycle.java | 20 + Java/code_unoptimised.java | 22 + JavaScript/code_cycle.js | 18 + JavaScript/code_unoptimised.js | 28 + Kotlin/Makefile | 10 + Kotlin/code_cycle.kt | 18 + Kotlin/code_unoptimised.kt | 20 + Python/code_cycle.py | 12 + Python/code_unoptimised.py | 17 + README.md | 17 +- Rust/Makefile | 7 + Rust/code_cycle/.gitignore | 1 + Rust/code_cycle/Cargo.lock | 7 + Rust/code_cycle/Cargo.toml | 19 + Rust/code_cycle/src/main.rs | 18 + Rust/code_unoptimised/.gitignore | 1 + Rust/code_unoptimised/Cargo.lock | 75 +++ Rust/code_unoptimised/Cargo.toml | 20 + Rust/code_unoptimised/src/main.rs | 22 + TypeScript/code_cycle.js | 13 + TypeScript/code_cycle.ts | 18 + TypeScript/code_unoptimised.js | 21 + TypeScript/code_unoptimised.ts | 28 + TypeScript/package-lock.json | 31 ++ TypeScript/package.json | 5 + TypeScript/tsconfig.json | 109 ++++ Zig/Makefile | 10 + Zig/code_cycle/build.zig | 70 +++ Zig/code_cycle/src/main.zig | 28 + Zig/code_unoptimised/build.zig | 70 +++ Zig/code_unoptimised/src/main.zig | 32 ++ benchmarking-config.conf | 11 + task.txt | 1 + www/scripts/2023-10-14_13-52-39.bench | 99 ++++ www/scripts/2023-10-14_14-04-49.bench | 99 ++++ ...full-benchmark-unbuffered-clean-sourced.sh | 194 +++++++ .../full-benchmark-unbuffered-clean.sh | 174 ++++++ www/scripts/full-benchmark-unbuffered.sh | 174 ++++++ www/scripts/full-benchmark.sh | 76 +++ .../python-cycle-2023-10-14_16-29-18.bench | 504 ++++++++++++++++++ ...thon-unoptimised-2023-10-14_14-48-43.bench | 504 ++++++++++++++++++ www/scripts/rhinemann-results.txt | 117 ++++ www/scripts/time-aggregation-live.sh | 34 ++ www/scripts/time-aggregation-progress.sh | 29 + www/scripts/time-aggregation.sh | 28 + 55 files changed, 2961 insertions(+), 1 deletion(-) create mode 100644 C/Makefile create mode 100755 C/code_cycle create mode 100644 C/code_cycle.c create mode 100755 C/code_unoptimised create mode 100644 C/code_unoptimised.c create mode 100644 Go/code_cycle/go.mod create mode 100644 Go/code_cycle/main.go create mode 100644 Go/code_unoptimised/go.mod create mode 100644 Go/code_unoptimised/main.go create mode 100644 Java/Makefile create mode 100644 Java/code_cycle.java create mode 100644 Java/code_unoptimised.java create mode 100644 JavaScript/code_cycle.js create mode 100644 JavaScript/code_unoptimised.js create mode 100644 Kotlin/Makefile create mode 100644 Kotlin/code_cycle.kt create mode 100644 Kotlin/code_unoptimised.kt create mode 100644 Python/code_cycle.py create mode 100644 Python/code_unoptimised.py create mode 100644 Rust/Makefile create mode 100644 Rust/code_cycle/.gitignore create mode 100644 Rust/code_cycle/Cargo.lock create mode 100644 Rust/code_cycle/Cargo.toml create mode 100644 Rust/code_cycle/src/main.rs create mode 100644 Rust/code_unoptimised/.gitignore create mode 100644 Rust/code_unoptimised/Cargo.lock create mode 100644 Rust/code_unoptimised/Cargo.toml create mode 100644 Rust/code_unoptimised/src/main.rs create mode 100644 TypeScript/code_cycle.js create mode 100644 TypeScript/code_cycle.ts create mode 100644 TypeScript/code_unoptimised.js create mode 100644 TypeScript/code_unoptimised.ts create mode 100644 TypeScript/package-lock.json create mode 100644 TypeScript/package.json create mode 100644 TypeScript/tsconfig.json create mode 100644 Zig/Makefile create mode 100644 Zig/code_cycle/build.zig create mode 100644 Zig/code_cycle/src/main.zig create mode 100644 Zig/code_unoptimised/build.zig create mode 100644 Zig/code_unoptimised/src/main.zig create mode 100644 benchmarking-config.conf create mode 100644 task.txt create mode 100644 www/scripts/2023-10-14_13-52-39.bench create mode 100644 www/scripts/2023-10-14_14-04-49.bench create mode 100644 www/scripts/full-benchmark-unbuffered-clean-sourced.sh create mode 100644 www/scripts/full-benchmark-unbuffered-clean.sh create mode 100644 www/scripts/full-benchmark-unbuffered.sh create mode 100644 www/scripts/full-benchmark.sh create mode 100644 www/scripts/python-cycle-2023-10-14_16-29-18.bench create mode 100644 www/scripts/python-unoptimised-2023-10-14_14-48-43.bench create mode 100644 www/scripts/rhinemann-results.txt create mode 100644 www/scripts/time-aggregation-live.sh create mode 100644 www/scripts/time-aggregation-progress.sh create mode 100644 www/scripts/time-aggregation.sh diff --git a/C/Makefile b/C/Makefile new file mode 100644 index 0000000..59c4620 --- /dev/null +++ b/C/Makefile @@ -0,0 +1,6 @@ +compile: + gcc code_cycle.c -O3 -o code_cycle + gcc code_unoptimised.c -O3 -o code_unoptimised + +clean: + rm code_cycle code_unoptimised \ No newline at end of file diff --git a/C/code_cycle b/C/code_cycle new file mode 100755 index 0000000000000000000000000000000000000000..c0e369ecc7ed24a7976f5ca37e20cb160658bccd GIT binary patch literal 16616 zcmeHOU2Ggz6~61WV<$~^onPFfkf9_ZY4Lj3X)GtL$*yB3W8@@m;)I6$OxNCBd&B-% zyR*bD2wXXhv?@*`$^$&`5?+dwhfw;!L)AF37164c1O$pGp{At5DbTtJsoc_dIcMg6 z>)G)d5JK=WSDHQdeCOw$Idf;`-kp2D)!wI(!fl4&?F=^OMgWvt&zB!DBHat<#zgj)B{C?OxbRs(qCmtKt-*|vz;N5 zJaEua83!ovVtb0|N7(33S%C_u)sAyBRd0yJR7)vUWqVzc!j4(Cn~`=i(hhV|wg-xQ za!&Y|kpAqnjbvOvS(i)KJ9>ocy29Li`j`m|P}n_Ab{yxwTafnsvb}}!QYYgFm8UBj z67im}B}ZmMs3#FtI`8jbT_MS*ai+P(LnXnMW&rK-GmK73L9dCBmi z=|4U^@c_roF|a?@;llbzKl09U^SqvB6*(I2MWUH#Up%WvGu?Z3Ceo>Bcep3PKKhdBl=PvQs$~^9tO}W7}6 zU^C(954pAR#jLeOo&)X^^y^xgylHtK0KY1qPn&|KA#m{5`GQd4YsuFDWzvH4^+%bq z;OOHlo3`Nc(PEg)Sa9ooP!}}BqM8WK*+iUQCj(9foD4V_a5CUzz{!A<0Vf0h{|u-j zf2mQQt-8@5g!;^wUQxKJj!e{y7XvG7eVasujW_AnyFN%Y=KEQGYqCIPdp@65>tQPZK>5_>ig_?@~4JX8!i*86J(tys3`~eIw?5|CfQWn0MeU@_ov1LGY!K zF;~nx`*S+RW8TlxpN~|Tu;w( zGr8wpA)hXFv}G+fKQ^_4;?4hlj&C5IVi+?f?*y+TwL9L2#_xC!R~<0wUm2TPLP~+L zBNWQ|HuCbUy|^&xT|dkxJ}xQgf8WsG`W+^lXVv_)dg;9#>ZKXC>bjy{o7Gp5 zgRRm*O<~fE3--e;he;%I4F}bcmNi^e^Y7?O)n{9_6En4k!kg-+5U*4Ph<6=>9q6sE zb54A?9A`sc?i_8o_^=S6Lmm0wgbsG(?}oZV`A-h2qxBaEKG3=O9`~WCpWG`H)Jyl= z`ntfI-u0q0f4ejPUR(Z8p~9-S)RA$Qy6r~pUG7^)j)jhfj)jhgG-^|DPc!;pNv|W& zDNY8Q3^*BZGT>yu$$*mqCj(9foD4V_a5C^;&47!(QgzT5zOWuor?T6Xjgckd5Pd6* zDA`<6@?Dv9Pq-(Zi0eb75L;pofWNQtw=Vvk#^27Y#}`OwJ%kwE;#%i^w3+nyyV?2o z3k9C}zfSZ#(cclBAo}ujq0r6p4+@2wM3>$!6xa`c=jGyhYQJy|*1Fa$t*$xis;*_6 z*9tsIb~G(5mh$>SY#oOZmpmq!rwlKG)|;E9PSVwqf=DwVf+m8sm(a&Nkk@5$ z;q|v%x?~{0&sLf^;vO?uL5oz40)KxmnCC;Fp-SIXjq@9j_Vg9i;E`vVz8U;cDgQ|F z#ki&a|24t7a(lZ?SfDEfSXaAy=g#fQrnYELJe*Pjep)OXsBhXVYf7WPG2jmb{C01p zyqiAGW4*ss;--HQux`B+cZ(@pP>aA#|1{K;NuZln`lBCN)an0;MFRb;6t5PzE~R*l z!1XM}7Yp>0QhZ6VKb7Ltdu{n-xts1fr7XTo1k2(c(Nz}r3f!lq?UJ%$Ma;TeEHAG2 zw@Tf#QvE_%{guW23#Iz21n&1ze6=XouiRpdz`E>GeYzWiR>Z8kMV(N};`a-GSsYKH zIbVGLRf-P^bBI~9g=KN6Y2mf+1cx?>b&G{LH_OuStEp2jKmNQJLSb zrVT&yukU$ENCiLDsf$|6BEnZtK8NLdhghSmp^75wR+2FA`TeAk@LK9W_I^@J_=<}8 z_scfMt&U~Aa{>H>^l$HnFH^mHbxg>!?V zH=P_vMD=LI=P$3p`&!~!IFktvY0;FP84|HfI2qL@1ZS8)pcjEks(oDm|!e`-QfW&zO?0MKf9Y za8bf&B+En-VK$JpfrKu6###EP>g!7rt49avmwON?rH$PCqW!YZ^hd}EIMdYZJf;Qe z)IvBJ@1^F`I(w$z_!{~slfp;cH%YzHdQ<%8b$@R%O<7%zhI`0kS@f1}!r?AKP6Ld@}qJ8`M^ZBuTtJK512NZc?d!8HF?avU#Il(-QUs* zK`}pszWw}vB<+jMC{j~W`(wi1{*P_;_Win#Np~Rj_AlD(FDRxaXpODIBX98cDpk0T z^F71`<3H@3}`v4byU;GxXRu7x18eAdLGS>@mN!AL>2ah z_%S~7OMA2feVGohVwP%*N%bNQ`_C5 + +int main() +{ + int iterations = 256*256*256; + int successes_amount = 0; + + for (int a = 0; a < 256; a++) + { + for (int b = 0; b < 256; b++) + { + for (int c = 0; c < 256; c++) + { + if (a + b + c > 300) + { + successes_amount++; + } + } + } + } + + printf("Iterations: %d\n", iterations); + printf("Valid sums: %d\n", successes_amount); + printf("Probability: %f\n", (float) successes_amount / iterations); + + return 0; +} diff --git a/C/code_unoptimised b/C/code_unoptimised new file mode 100755 index 0000000000000000000000000000000000000000..3641ca244899abe2c8980ba496fdb87afb3a70d8 GIT binary patch literal 16712 zcmeHOeQX>@6`#AaV<&a?E@_fpK3Xp&5l+CDvq>zcmC3DrcGi`X7{?A@P1a}M**>@r zbGHX}05z4{D5u1&CHRByhL1mj1QH+=B0lXpw50;%2+>-tBHWVFOGHyQG?fd)$9uE$ z&U@=Kv_j&q9ck}3?>FzgnSDFEJ99hpP-{n<)8Sy0T6|+Mf(ZG>9XCi zXkWvg-LY_OESkuS)Q&VZ)Hdw#rIWsTe%>3PA=sx59O_}OK7Y$ob+O@h4TsM?Cp~lJ z^IgxM`82j0+kpO12NUX3_z^4Mz;fff9)_I3AzqIBA&$6G!uZG~3en&C5F1VXlwAmjBfMROA7H6aBFr?ce> zi-)2KhBC&ufgR{*Z*I}*ef7S*Ol$8xsD&e`$Y32}?JiFiE z@mk|GqBLjXv42p?nRvPfux#GMi$@PPSupX~uPAu~Mh-dZd&tNE{5AU9ySc9nEBn`u zfE@ul0(J!K2-p#@BVb3sj=(#MfI9ZKO7%?nmEDY~k51~&{ERwwsdBntoZtI06yeAO_s8PhP~f1HB38n~HnarJL^K<*1YMfCfgRZt@eyln0e#)9z|k_gZ`Q@^Ll$ zvO0EkzO%byy!_)}ua2+%yWyn@Z1NjV!4&3AexBg?G6?E;`LhW77W9n}?&Fw;aIenK zxvNiNtiU%%(Ek?K-}_aBor`LAUY)wJU!7WTsg9@A%ZvI3aIjZ6sLan9@g)0`O(7^^ zncY3=SkorVs@YfcD)mfLGYGk3i}`$R2%7j*`96>xcuu@t!fT&{!U3PV`VlZ?Yyz)X z?k=#xKzs#a?wH{rCw=839pg<;yq_`UXnXcKrKdf6OX*g!|LRf4YbSs{(y{Y4_wmKs z;A85xOW#`eBE+#Hd$S{ZBba?v$#3|xIyUW4_g%?c$4ZP?E5{WL>R{Ltc^@t6mAq~C zj~xL!0(J!K2-p#@BVb3sj({BjI|6nD>}EbM!>qX%kpFW46n?+OJ@iem z$5`SY7Iv~DU`N1?fE@ul0(J!K2-p#@BVb3sj=)M0pmmb8E|TUD_=ONtl>vo?m$-fu z(|5)CN*6x7OR>F_<=iR8H$>545!0 zC)WfcebG=tuJgmX;JVs|ogydK`|Iocb#)YcGPa-#R^HOOe{+!w{*$2f>&3i_<>h z3+_I-B)^t*mgFVYTatGd?$_daL0L94M&8BN71sTmOI@&{{B%kEI}7)JvHk`|_kA(H zk(KISF1Cr$`s-qSxGMu@#>l&vm(`TyH?zi)JUxw;eBpgq#@@&;F-8ub3#IsK;GGQO zEY^{e-FpN-Vd3`(o}RCy{{UnhY^j~}JUGhv<#GFh@I%jQ@`KMo2U{NhmD+!v>#t|O zzy@1Vsq?+Sb?#ht9iIl?!Iodg8KF<_1FGULJhQxCy~X`3zrIrt5GOv}E&aI)`1KI~ zbK?C&aoYwNnJP2k!<=8xA!lTE;{cP_tQ_9JidOWCd!_+idVOt!oy9|9ih zwf5Vyz{}*+gkJ-Gozu(c`AS9Sk;mW&Bk}rRKLsA+6A<ds(%%D*;F587lFT*1QTv{mX0&)Plh8} zCXpQ0qw#1u68818{*<29GXn#VUD|b`>2a+e_no9+&q+9`4aVS4>X;VRlc}^8%8Y=c z_;4(ug9m?U4czz=)k3LMXjF?N^wcODNQL4NEu4wRN5RA-X`rbWscKqVmvXRGYdsXy zV4F*^0_>~_e(aEPu)U?Ygzu~Y3N|2Vt*Y>#2D_McpyP0}(xDx0Ydg}~t#vES9j)k< z@5kv+XLwWp^S+x%IHZTf?w&x=ZXN5co}$vhh_2yYpk!R@i|SA%x-quzfKa@bM+>Ku z+7Kw?KA-l(pcRfLv5y5=v z(YPM!1JqLn4p9!aI7L#!%$G>&5#L}UrVe42lEGVV9y;ctmGF~>VL}Ocph$5corLp#$|*w zo)^Vjm-2}3g#*XXWKZKa!tJPJO7t8fssS=)dm85v%A_dJY99ptEf`Z%{WKmVr21*z zLF0RJdk8W(#~^zeHxfB_c;zh$)3iSgfx#4ZkEOGI27QVf$V79_LZkmhTGL-8SvDnkRn{YKL3dCz=PTvE;eE%|8lnM+8k$~Dw@{b^6whzcg31N^F z1zPL>HSlKp)3TvRh~qGGvey4wD3sv9dk7PaD`}swRi9+SKY@)K4zj2D$b2n&Tk3Cy zv?P=LOHhD)kL+pQLi@1iMEj|Kk{w;gFM} +#include + +#define TOTAL_ATTEMPTS 15000000 + +int get_random_bit() +{ + int r = rand() % 256; + return r; +} + +int main() +{ + int successful_attempts = 0; + + for (int i = 0; i < TOTAL_ATTEMPTS; i++) + { + int a = get_random_bit(); + int b = get_random_bit(); + int c = get_random_bit(); + + if (a + b + c > 300) + { + successful_attempts++; + } + } + + printf("Iterations: %d\n", TOTAL_ATTEMPTS); + printf("Valid sums: %d\n", successful_attempts); + printf("Probability: %lf\n", (double) ((double) successful_attempts / (double) TOTAL_ATTEMPTS)); + + return 0; +} \ No newline at end of file diff --git a/Go/code_cycle/go.mod b/Go/code_cycle/go.mod new file mode 100644 index 0000000..1bbf8b6 --- /dev/null +++ b/Go/code_cycle/go.mod @@ -0,0 +1,3 @@ +module example/hello + +go 1.23 diff --git a/Go/code_cycle/main.go b/Go/code_cycle/main.go new file mode 100644 index 0000000..8f7c7ff --- /dev/null +++ b/Go/code_cycle/main.go @@ -0,0 +1,24 @@ +package main + +import "fmt" + +func main() { + var ( + iterations int = 256 * 256 * 256 + successes_amount int = 0 + ) + + for a := 0; a < 256; a++ { + for b := 0; b < 256; b++ { + for c := 0; c < 256; c++ { + if a+b+c > 300 { + successes_amount++ + } + } + } + } + + fmt.Printf("Iterations: %v\n", iterations) + fmt.Printf("Valid sums: %v\n", successes_amount) + fmt.Printf("Probability: %v\n", (float32(successes_amount) / float32(iterations))) +} diff --git a/Go/code_unoptimised/go.mod b/Go/code_unoptimised/go.mod new file mode 100644 index 0000000..1bbf8b6 --- /dev/null +++ b/Go/code_unoptimised/go.mod @@ -0,0 +1,3 @@ +module example/hello + +go 1.23 diff --git a/Go/code_unoptimised/main.go b/Go/code_unoptimised/main.go new file mode 100644 index 0000000..21ee662 --- /dev/null +++ b/Go/code_unoptimised/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "math/rand" +) + +func main() { + var ( + total_attempts int = 15_000_000 + successes_amount int = 0 + ) + + for i := 0; i < total_attempts; i++ { + var ( + a int = rand.Intn(255) + b int = rand.Intn(255) + c int = rand.Intn(255) + ) + + if a+b+c > 300 { + successes_amount++ + } + } + + fmt.Printf("Iterations: %v\n", total_attempts) + fmt.Printf("Valid sums: %v\n", successes_amount) + fmt.Printf("Probability: %v\n", (float32(successes_amount) / float32(total_attempts))) +} diff --git a/Java/Makefile b/Java/Makefile new file mode 100644 index 0000000..2d50c3b --- /dev/null +++ b/Java/Makefile @@ -0,0 +1,6 @@ +compile: + javac code_cycle.java + javac code_unoptimised.java + +clean: + rm *.class \ No newline at end of file diff --git a/Java/code_cycle.java b/Java/code_cycle.java new file mode 100644 index 0000000..3ef3c16 --- /dev/null +++ b/Java/code_cycle.java @@ -0,0 +1,20 @@ +public class code_cycle { + public static void main(String[] args) { + int total_attempts = 256*256*256; + int successful_attempts = 0; + + for (int a = 0; a < 256; a++) { + for (int b = 0; b < 256; b++) { + for (int c = 0; c < 256; c++) { + if (a + b + c > 300) { + successful_attempts++; + } + } + } + } + + System.out.println("Iterations: " + total_attempts); + System.out.println("Valid sums: " + successful_attempts); + System.out.println("Probability: " + (float) successful_attempts / total_attempts); + } +} diff --git a/Java/code_unoptimised.java b/Java/code_unoptimised.java new file mode 100644 index 0000000..8ec9d34 --- /dev/null +++ b/Java/code_unoptimised.java @@ -0,0 +1,22 @@ +import java.util.concurrent.ThreadLocalRandom; + +public class code_unoptimised { + public static void main(String[] args) { + int total_attempts = 15_000_000; + int successful_attempts = 0; + + for (int i = 0; i < total_attempts; i++) { + int a = ThreadLocalRandom.current().nextInt(256); + int b = ThreadLocalRandom.current().nextInt(256); + int c = ThreadLocalRandom.current().nextInt(256); + + if (a + b + c > 300) { + successful_attempts++; + } + } + + System.out.println("Iterations: " + total_attempts); + System.out.println("Valid sums: " + successful_attempts); + System.out.println("Probability: " + (float) successful_attempts / total_attempts); + } +} \ No newline at end of file diff --git a/JavaScript/code_cycle.js b/JavaScript/code_cycle.js new file mode 100644 index 0000000..dde789b --- /dev/null +++ b/JavaScript/code_cycle.js @@ -0,0 +1,18 @@ +const total_attempts = 256*256*256; +var successful_attempts = 0; + +for (var a = 0; a < 256; a++) +{ + for (var b = 0; b < 256; b++) + { + for (var c = 0; c < 256; c++) + { + if (a + b + c > 300) + successful_attempts++; + } + } +} + +console.log("Iterations: " + total_attempts); +console.log("Successful checks: " + successful_attempts); +console.log("Probability: " + (successful_attempts/total_attempts)); diff --git a/JavaScript/code_unoptimised.js b/JavaScript/code_unoptimised.js new file mode 100644 index 0000000..58b002f --- /dev/null +++ b/JavaScript/code_unoptimised.js @@ -0,0 +1,28 @@ +const total_attempts = 15000000; +var successful_attempts = 0; + +var get_random = () => { + return Math.floor(Math.random() * 256); +} + +for (var i = 0; i < total_attempts; i++) +{ + /* + var a = Math.floor(Math.random() * 256); + var b = Math.floor(Math.random() * 256); + var c = Math.floor(Math.random() * 256); + */ + + var a = get_random(); + var b = get_random(); + var c = get_random(); + + if (a + b + c > 300) + { + successful_attempts++; + } +} + +console.log("Iterations: " + total_attempts); +console.log("Successful checks: " + successful_attempts); +console.log("Probability: " + (successful_attempts/total_attempts)); diff --git a/Kotlin/Makefile b/Kotlin/Makefile new file mode 100644 index 0000000..cd25569 --- /dev/null +++ b/Kotlin/Makefile @@ -0,0 +1,10 @@ +compile: + kotlinc code_cycle.kt -include-runtime -d code_cycle.jar + kotlinc code_unoptimised.kt -include-runtime -d code_unoptimised.jar + +compile-on-premise: + /home/shared-space-1/kotlinc/bin/kotlinc code_cycle.kt -include-runtime -d code_cycle.jar + /home/shared-space-1/kotlinc/bin/kotlinc code_unoptimised.kt -include-runtime -d code_unoptimised.jar + +clean: + rm *.jar diff --git a/Kotlin/code_cycle.kt b/Kotlin/code_cycle.kt new file mode 100644 index 0000000..148b0e1 --- /dev/null +++ b/Kotlin/code_cycle.kt @@ -0,0 +1,18 @@ +fun main(args: Array) { + val totalAttempts: Int = 256*256*256 + var successfulAttempts: Int = 0 + + for (a in 0..255) { + for (b in 0..255) { + for (c in 0..255) { + if (a + b + c > 300) { + successfulAttempts++ + } + } + } + } + + println("Iterations: $totalAttempts") + println("Valid sums: $successfulAttempts") + println("Probability: ${successfulAttempts.toFloat() / totalAttempts.toFloat()}") +} \ No newline at end of file diff --git a/Kotlin/code_unoptimised.kt b/Kotlin/code_unoptimised.kt new file mode 100644 index 0000000..e7f88d3 --- /dev/null +++ b/Kotlin/code_unoptimised.kt @@ -0,0 +1,20 @@ +import kotlin.random.Random + +fun main(args: Array) { + val totalAttempts: Int = 15_000_000 + var successfulAttempts: Int = 0 + + for (i in 0..totalAttempts) { + var a: Int = Random.nextInt(256) + var b: Int = Random.nextInt(256) + var c: Int = Random.nextInt(256) + + if (a + b + c > 300) { + successfulAttempts++ + } + } + + println("Iterations: $totalAttempts") + println("Valid sums: $successfulAttempts") + println("Probability: ${successfulAttempts.toFloat() / totalAttempts.toFloat()}") +} \ No newline at end of file diff --git a/Python/code_cycle.py b/Python/code_cycle.py new file mode 100644 index 0000000..c0bd23b --- /dev/null +++ b/Python/code_cycle.py @@ -0,0 +1,12 @@ +total_attempts = 256*256*256 +successful_attempts = 0 + +for a in range(0, 256): + for b in range(0, 256): + for c in range(0, 256): + if a + b + c > 300: + successful_attempts += 1 + +print(f"Iterations: {total_attempts}") +print(f"Valid sums: {successful_attempts}") +print(f"Probability: {successful_attempts / total_attempts}") diff --git a/Python/code_unoptimised.py b/Python/code_unoptimised.py new file mode 100644 index 0000000..d272d2e --- /dev/null +++ b/Python/code_unoptimised.py @@ -0,0 +1,17 @@ +from random import randint + +total_attempts = 15_000_000 +successful_attempts = 0 + +for i in range(0, total_attempts): + a = randint(0, 256) + b = randint(0, 256) + c = randint(0, 256) + + if a + b + c > 300: + successful_attempts += 1 + + +print(f"Iterations: {total_attempts}") +print(f"Valid sums: {successful_attempts}") +print(f"Probability: {successful_attempts / total_attempts}") diff --git a/README.md b/README.md index 9adae48..e5f729c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,18 @@ # Basic-benchmark-experiment -A very basic speed comparison between different languages. \ No newline at end of file +A very basic speed comparison between different languages. + +The results can be seen in www/scripts. + +Credits: +| Language implementation | Author | +| :- | -: | +| C | | +| Go | | +| Java | | +| JavaStript | | +| Kotlin | | +| Python | | +| Rust | | +| TypeStript | | +| Zig | | diff --git a/Rust/Makefile b/Rust/Makefile new file mode 100644 index 0000000..ea9d198 --- /dev/null +++ b/Rust/Makefile @@ -0,0 +1,7 @@ +compile: + cargo build --release --manifest-path code_cycle/Cargo.toml + cargo build --release --manifest-path code_unoptimised/Cargo.toml + +clean: + cargo clean --manifest-path code_cycle/Cargo.toml + cargo clean --manifest-path code_unoptimised/Cargo.toml diff --git a/Rust/code_cycle/.gitignore b/Rust/code_cycle/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/Rust/code_cycle/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Rust/code_cycle/Cargo.lock b/Rust/code_cycle/Cargo.lock new file mode 100644 index 0000000..a16d210 --- /dev/null +++ b/Rust/code_cycle/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "code_cycle" +version = "0.1.0" diff --git a/Rust/code_cycle/Cargo.toml b/Rust/code_cycle/Cargo.toml new file mode 100644 index 0000000..65f2909 --- /dev/null +++ b/Rust/code_cycle/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "code_cycle" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[profile.dev.package."*"] # + +opt-level = "z" # Optimize library for size + +[profile.release] +#opt-level = 'z' # Optimize for size +opt-level = 3 # Optimize for speed +lto = true # Enable link-time optimization +codegen-units = 1 # Reduce number of codegen units to increase optimizations +panic = 'abort' # Abort on panic +strip = true # Strip symbols from binary* + +[dependencies] diff --git a/Rust/code_cycle/src/main.rs b/Rust/code_cycle/src/main.rs new file mode 100644 index 0000000..fa16dc1 --- /dev/null +++ b/Rust/code_cycle/src/main.rs @@ -0,0 +1,18 @@ +fn main() { + let total_attempts: i32 = 256*256*256; + let mut successful_attempts: i32 = 0; + + for a in 0..256 { + for b in 0..256 { + for c in 0..256 { + if a + b + c > 300 { + successful_attempts += 1; + } + } + } + } + + println!("Iterations: {}", total_attempts); + println!("Valid sums: {}", successful_attempts); + println!("Probability: {}", successful_attempts as f32 / total_attempts as f32); +} diff --git a/Rust/code_unoptimised/.gitignore b/Rust/code_unoptimised/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/Rust/code_unoptimised/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Rust/code_unoptimised/Cargo.lock b/Rust/code_unoptimised/Cargo.lock new file mode 100644 index 0000000..198ef32 --- /dev/null +++ b/Rust/code_unoptimised/Cargo.lock @@ -0,0 +1,75 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "code_unoptimised" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" diff --git a/Rust/code_unoptimised/Cargo.toml b/Rust/code_unoptimised/Cargo.toml new file mode 100644 index 0000000..5b2fded --- /dev/null +++ b/Rust/code_unoptimised/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "code_unoptimised" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[profile.dev.package."*"] # + +opt-level = "z" # Optimize library for size + +[profile.release] +#opt-level = 'z' # Optimize for size +opt-level = 3 # Optimize for speed +lto = true # Enable link-time optimization +codegen-units = 1 # Reduce number of codegen units to increase optimizations +panic = 'abort' # Abort on panic +strip = true # Strip symbols from binary* + +[dependencies] +rand = "0.8.5" \ No newline at end of file diff --git a/Rust/code_unoptimised/src/main.rs b/Rust/code_unoptimised/src/main.rs new file mode 100644 index 0000000..bb408fb --- /dev/null +++ b/Rust/code_unoptimised/src/main.rs @@ -0,0 +1,22 @@ +fn main() { + let total_attempts: i32 = 15_000_000; + + let mut successful_attempts: i32 = 0; + + for _ in 0..total_attempts { + let a = rand::random::() as u16; + let b = rand::random::() as u16; + let c = rand::random::() as u16; + + if a + b + c > 300 { + successful_attempts += 1; + } + } + + println!("Iterations: {}", total_attempts); + println!("Valid sums: {}", successful_attempts); + println!( + "Probability: {}", + successful_attempts as f32 / total_attempts as f32 + ); +} diff --git a/TypeScript/code_cycle.js b/TypeScript/code_cycle.js new file mode 100644 index 0000000..e0aa825 --- /dev/null +++ b/TypeScript/code_cycle.js @@ -0,0 +1,13 @@ +var total_attempts = 256 * 256 * 256; +var successful_attempts = 0; +for (var a = 0; a < 256; a++) { + for (var b = 0; b < 256; b++) { + for (var c = 0; c < 256; c++) { + if (a + b + c > 300) + successful_attempts++; + } + } +} +console.log("Iterations: " + total_attempts); +console.log("Successful checks: " + successful_attempts); +console.log("Probability: " + (successful_attempts / total_attempts)); diff --git a/TypeScript/code_cycle.ts b/TypeScript/code_cycle.ts new file mode 100644 index 0000000..dde789b --- /dev/null +++ b/TypeScript/code_cycle.ts @@ -0,0 +1,18 @@ +const total_attempts = 256*256*256; +var successful_attempts = 0; + +for (var a = 0; a < 256; a++) +{ + for (var b = 0; b < 256; b++) + { + for (var c = 0; c < 256; c++) + { + if (a + b + c > 300) + successful_attempts++; + } + } +} + +console.log("Iterations: " + total_attempts); +console.log("Successful checks: " + successful_attempts); +console.log("Probability: " + (successful_attempts/total_attempts)); diff --git a/TypeScript/code_unoptimised.js b/TypeScript/code_unoptimised.js new file mode 100644 index 0000000..95961d6 --- /dev/null +++ b/TypeScript/code_unoptimised.js @@ -0,0 +1,21 @@ +var total_attempts = 15000000; +var successful_attempts = 0; +var get_random = function () { + return Math.floor(Math.random() * 256); +}; +for (var i = 0; i < total_attempts; i++) { + /* + var a = Math.floor(Math.random() * 256); + var b = Math.floor(Math.random() * 256); + var c = Math.floor(Math.random() * 256); + */ + var a = get_random(); + var b = get_random(); + var c = get_random(); + if (a + b + c > 300) { + successful_attempts++; + } +} +console.log("Iterations: " + total_attempts); +console.log("Successful checks: " + successful_attempts); +console.log("Probability: " + (successful_attempts / total_attempts)); diff --git a/TypeScript/code_unoptimised.ts b/TypeScript/code_unoptimised.ts new file mode 100644 index 0000000..58b002f --- /dev/null +++ b/TypeScript/code_unoptimised.ts @@ -0,0 +1,28 @@ +const total_attempts = 15000000; +var successful_attempts = 0; + +var get_random = () => { + return Math.floor(Math.random() * 256); +} + +for (var i = 0; i < total_attempts; i++) +{ + /* + var a = Math.floor(Math.random() * 256); + var b = Math.floor(Math.random() * 256); + var c = Math.floor(Math.random() * 256); + */ + + var a = get_random(); + var b = get_random(); + var c = get_random(); + + if (a + b + c > 300) + { + successful_attempts++; + } +} + +console.log("Iterations: " + total_attempts); +console.log("Successful checks: " + successful_attempts); +console.log("Probability: " + (successful_attempts/total_attempts)); diff --git a/TypeScript/package-lock.json b/TypeScript/package-lock.json new file mode 100644 index 0000000..36c263c --- /dev/null +++ b/TypeScript/package-lock.json @@ -0,0 +1,31 @@ +{ + "name": "TypeScript", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "typescript": "^5.2.2" + } + }, + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + }, + "dependencies": { + "typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==" + } + } +} diff --git a/TypeScript/package.json b/TypeScript/package.json new file mode 100644 index 0000000..9b3b832 --- /dev/null +++ b/TypeScript/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "typescript": "^5.2.2" + } +} diff --git a/TypeScript/tsconfig.json b/TypeScript/tsconfig.json new file mode 100644 index 0000000..e075f97 --- /dev/null +++ b/TypeScript/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/Zig/Makefile b/Zig/Makefile new file mode 100644 index 0000000..f9fef50 --- /dev/null +++ b/Zig/Makefile @@ -0,0 +1,10 @@ +compile: + cd code_cycle; zig build -Doptimize=ReleaseFast + cd code_unoptimised; zig build -Doptimize=ReleaseFast + +compile-on-premise: + cd code_cycle; /home/shared-space-1/zig-linux-x86_64-0.11.0/zig build -Doptimize=ReleaseFast + cd code_unoptimised; /home/shared-space-1/zig-linux-x86_64-0.11.0/zig build -Doptimize=ReleaseFast + +clean: + rm -r */zig-* diff --git a/Zig/code_cycle/build.zig b/Zig/code_cycle/build.zig new file mode 100644 index 0000000..46105ba --- /dev/null +++ b/Zig/code_cycle/build.zig @@ -0,0 +1,70 @@ +const std = @import("std"); + +// Although this function looks imperative, note that its job is to +// declaratively construct a build graph that will be executed by an external +// runner. +pub fn build(b: *std.Build) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard optimization options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not + // set a preferred release mode, allowing the user to decide how to optimize. + const optimize = b.standardOptimizeOption(.{}); + + const exe = b.addExecutable(.{ + .name = "code_cycle", + // In this case the main source file is merely a path, however, in more + // complicated build scripts, this could be a generated file. + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + // This declares intent for the executable to be installed into the + // standard location when the user invokes the "install" step (the default + // step when running `zig build`). + b.installArtifact(exe); + + // This *creates* a Run step in the build graph, to be executed when another + // step is evaluated that depends on it. The next line below will establish + // such a dependency. + const run_cmd = b.addRunArtifact(exe); + + // By making the run step depend on the install step, it will be run from the + // installation directory rather than directly from within the cache directory. + // This is not necessary, however, if the application depends on other installed + // files, this ensures they will be present and in the expected location. + run_cmd.step.dependOn(b.getInstallStep()); + + // This allows the user to pass arguments to the application in the build + // command itself, like this: `zig build run -- arg1 arg2 etc` + if (b.args) |args| { + run_cmd.addArgs(args); + } + + // This creates a build step. It will be visible in the `zig build --help` menu, + // and can be selected like this: `zig build run` + // This will evaluate the `run` step rather than the default, which is "install". + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + + // Creates a step for unit testing. This only builds the test executable + // but does not run it. + const unit_tests = b.addTest(.{ + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + const run_unit_tests = b.addRunArtifact(unit_tests); + + // Similar to creating the run step earlier, this exposes a `test` step to + // the `zig build --help` menu, providing a way for the user to request + // running the unit tests. + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&run_unit_tests.step); +} diff --git a/Zig/code_cycle/src/main.zig b/Zig/code_cycle/src/main.zig new file mode 100644 index 0000000..9282a15 --- /dev/null +++ b/Zig/code_cycle/src/main.zig @@ -0,0 +1,28 @@ +const std = @import("std"); + +pub fn main() !void { + const stdout_file = std.io.getStdOut().writer(); + var bw = std.io.bufferedWriter(stdout_file); + const stdout = bw.writer(); + + const total_attempts: i32 = 256 * 256 * 256; + var successful_attempts: i32 = 0; + + for (0..256) |a| { + for (0..256) |b| { + for (0..256) |c| { + if (a + b + c > 300) { + successful_attempts += 1; + } + } + } + } + + // const probability = @as(f32, @floatFromInt(successful_attempts)) / @as(f32, @floatFromInt(total_attempts)); + + try stdout.print("Iterations: {}\n", .{total_attempts}); + try stdout.print("Valid sums: {}\n", .{successful_attempts}); + try stdout.print("Probability: {d:.7}\n", .{@as(f32, @floatFromInt(successful_attempts)) / @as(f32, @floatFromInt(total_attempts))}); + + try bw.flush(); // don't forget to flush! +} diff --git a/Zig/code_unoptimised/build.zig b/Zig/code_unoptimised/build.zig new file mode 100644 index 0000000..5df33f7 --- /dev/null +++ b/Zig/code_unoptimised/build.zig @@ -0,0 +1,70 @@ +const std = @import("std"); + +// Although this function looks imperative, note that its job is to +// declaratively construct a build graph that will be executed by an external +// runner. +pub fn build(b: *std.Build) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard optimization options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not + // set a preferred release mode, allowing the user to decide how to optimize. + const optimize = b.standardOptimizeOption(.{}); + + const exe = b.addExecutable(.{ + .name = "code_unoptimised", + // In this case the main source file is merely a path, however, in more + // complicated build scripts, this could be a generated file. + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + // This declares intent for the executable to be installed into the + // standard location when the user invokes the "install" step (the default + // step when running `zig build`). + b.installArtifact(exe); + + // This *creates* a Run step in the build graph, to be executed when another + // step is evaluated that depends on it. The next line below will establish + // such a dependency. + const run_cmd = b.addRunArtifact(exe); + + // By making the run step depend on the install step, it will be run from the + // installation directory rather than directly from within the cache directory. + // This is not necessary, however, if the application depends on other installed + // files, this ensures they will be present and in the expected location. + run_cmd.step.dependOn(b.getInstallStep()); + + // This allows the user to pass arguments to the application in the build + // command itself, like this: `zig build run -- arg1 arg2 etc` + if (b.args) |args| { + run_cmd.addArgs(args); + } + + // This creates a build step. It will be visible in the `zig build --help` menu, + // and can be selected like this: `zig build run` + // This will evaluate the `run` step rather than the default, which is "install". + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + + // Creates a step for unit testing. This only builds the test executable + // but does not run it. + const unit_tests = b.addTest(.{ + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + const run_unit_tests = b.addRunArtifact(unit_tests); + + // Similar to creating the run step earlier, this exposes a `test` step to + // the `zig build --help` menu, providing a way for the user to request + // running the unit tests. + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&run_unit_tests.step); +} diff --git a/Zig/code_unoptimised/src/main.zig b/Zig/code_unoptimised/src/main.zig new file mode 100644 index 0000000..318811f --- /dev/null +++ b/Zig/code_unoptimised/src/main.zig @@ -0,0 +1,32 @@ +const std = @import("std"); + +pub fn main() !void { + const stdout_file = std.io.getStdOut().writer(); + var bw = std.io.bufferedWriter(stdout_file); + const stdout = bw.writer(); + + const total_attempts: i32 = 15_000_000; + var successful_attempts: i32 = 0; + + var prng = std.rand.DefaultPrng.init(blk: { + var seed: u64 = undefined; + try std.os.getrandom(std.mem.asBytes(&seed)); + break :blk seed; + }); + const rand = prng.random(); + + for (0..total_attempts) |_| { + const a: i32 = rand.intRangeAtMost(i32, 0, 255); + const b: i32 = rand.intRangeAtMost(i32, 0, 255); + const c: i32 = rand.intRangeAtMost(i32, 0, 255); + if (a + b + c > 300) { + successful_attempts += 1; + } + } + + try stdout.print("Iterations: {}\n", .{total_attempts}); + try stdout.print("Valid sums: {}\n", .{successful_attempts}); + try stdout.print("Probability: {d:.7}\n", .{@as(f32, @floatFromInt(successful_attempts)) / @as(f32, @floatFromInt(total_attempts))}); + + try bw.flush(); // don't forget to flush! +} diff --git a/benchmarking-config.conf b/benchmarking-config.conf new file mode 100644 index 0000000..f7fee11 --- /dev/null +++ b/benchmarking-config.conf @@ -0,0 +1,11 @@ +server.modules = ( "mod_cgi" ) + +dir-listing.encoding = "UTF-8" + +dir-listing.activate = "enable" +mimetype.assign = ( ".txt" => "text/plain", ".ico" => "image/x-icon", ".html" => "text/html; charset=UTF-8", ".css" => "text/css", ".js" => "script/javascript", ".webm" => "video/webm", ".mp4" => "video/mp4", ".mkv" => "video/mkv", ".conf" => "text/plain", ".png" => "image/png", ".jpg" => "image/jpg", ".pdf" => "application/pdf", ".ogg" => "audio/ogg", ".py" => "text/x-python", "" => "text/plain" ) +server.bind = "10.1.1.1" +server.port = 25531 +server.document-root = "/home/shared-space-1/presentation/code/www/" + +cgi.assign = (".sh" => "/bin/bash") diff --git a/task.txt b/task.txt new file mode 100644 index 0000000..b61f3de --- /dev/null +++ b/task.txt @@ -0,0 +1 @@ +Визначити ймовірність того, що сума трьох випад­кових байтів більша за 300. diff --git a/www/scripts/2023-10-14_13-52-39.bench b/www/scripts/2023-10-14_13-52-39.bench new file mode 100644 index 0000000..20f0826 --- /dev/null +++ b/www/scripts/2023-10-14_13-52-39.bench @@ -0,0 +1,99 @@ +--- C --- +Unoptimised: +Total real time: 6117ms; Average real time: 305.850ms +Total user time: 6089ms; Average user time: 304.450ms +Total system time: 16ms; Average system time: .800ms + +Cycle: +Total real time: 63ms; Average real time: 3.150ms +Total user time: 56ms; Average user time: 2.800ms +Total system time: 9ms; Average system time: .450ms + +--- Go --- +Unoptimised: +Total real time: 19365ms; Average real time: 968.250ms +Total user time: 19373ms; Average user time: 968.650ms +Total system time: 1547ms; Average system time: 77.350ms + +Cycle: +Total real time: 3133ms; Average real time: 156.650ms +Total user time: 2868ms; Average user time: 143.400ms +Total system time: 1295ms; Average system time: 64.750ms + +--- Java --- +Unoptimised: +Total real time: 3216ms; Average real time: 160.800ms +Total user time: 3189ms; Average user time: 159.450ms +Total system time: 397ms; Average system time: 19.850ms + +Cycle: +Total real time: 1589ms; Average real time: 79.450ms +Total user time: 1374ms; Average user time: 68.700ms +Total system time: 416ms; Average system time: 20.800ms + +--- JavaScript --- +Unoptimised: +Total real time: 16836ms; Average real time: 841.800ms +Total user time: 16511ms; Average user time: 825.550ms +Total system time: 628ms; Average system time: 31.400ms + +Cycle: +Total real time: 2185ms; Average real time: 109.250ms +Total user time: 1919ms; Average user time: 95.950ms +Total system time: 298ms; Average system time: 14.900ms + +--- Kotlin --- +Unoptimised: +Total real time: 3099ms; Average real time: 154.950ms +Total user time: 3214ms; Average user time: 160.700ms +Total system time: 407ms; Average system time: 20.350ms + +Cycle: +Total real time: 1337ms; Average real time: 66.850ms +Total user time: 1241ms; Average user time: 62.050ms +Total system time: 430ms; Average system time: 21.500ms + +--- Python --- +Unoptimised: +Total real time: 39803ms; Average real time: 39803.000ms +Total user time: 39758ms; Average user time: 39758.000ms +Total system time: 12ms; Average system time: 12.000ms + +Cycle: +Total real time: 2572ms; Average real time: 2572.000ms +Total user time: 2558ms; Average user time: 2558.000ms +Total system time: 8ms; Average system time: 8.000ms + +--- Rust --- +Unoptimised: +Total real time: 4809ms; Average real time: 240.450ms +Total user time: 4746ms; Average user time: 237.300ms +Total system time: 52ms; Average system time: 2.600ms + +Cycle: +Total real time: 60ms; Average real time: 3.000ms +Total user time: 48ms; Average user time: 2.400ms +Total system time: 12ms; Average system time: .600ms + +--- TypeScript --- +Unoptimised: +Total real time: 0ms; Average real time: 0ms +Total user time: 0ms; Average user time: 0ms +Total system time: 0ms; Average system time: 0ms + +Cycle: +Total real time: 2024ms; Average real time: 101.200ms +Total user time: 1821ms; Average user time: 91.050ms +Total system time: 231ms; Average system time: 11.550ms + +--- Zig --- +Unoptimised: +Total real time: 1183ms; Average real time: 59.150ms +Total user time: 1174ms; Average user time: 58.700ms +Total system time: 8ms; Average system time: .400ms + +Cycle: +Total real time: 63ms; Average real time: 3.150ms +Total user time: 57ms; Average user time: 2.850ms +Total system time: 6ms; Average system time: .300ms + diff --git a/www/scripts/2023-10-14_14-04-49.bench b/www/scripts/2023-10-14_14-04-49.bench new file mode 100644 index 0000000..d72263e --- /dev/null +++ b/www/scripts/2023-10-14_14-04-49.bench @@ -0,0 +1,99 @@ +--- C --- +Unoptimised: +Total real time: 30467ms; Average real time: 304.670ms +Total user time: 30329ms; Average user time: 303.290ms +Total system time: 84ms; Average system time: .840ms + +Cycle: +Total real time: 349ms; Average real time: 3.490ms +Total user time: 307ms; Average user time: 3.070ms +Total system time: 39ms; Average system time: .390ms + +--- Go --- +Unoptimised: +Total real time: 97167ms; Average real time: 971.670ms +Total user time: 96800ms; Average user time: 968.000ms +Total system time: 7992ms; Average system time: 79.920ms + +Cycle: +Total real time: 16011ms; Average real time: 160.110ms +Total user time: 14347ms; Average user time: 143.470ms +Total system time: 6989ms; Average system time: 69.890ms + +--- Java --- +Unoptimised: +Total real time: 16278ms; Average real time: 162.780ms +Total user time: 16051ms; Average user time: 160.510ms +Total system time: 2255ms; Average system time: 22.550ms + +Cycle: +Total real time: 7537ms; Average real time: 75.370ms +Total user time: 6799ms; Average user time: 67.990ms +Total system time: 2042ms; Average system time: 20.420ms + +--- JavaScript --- +Unoptimised: +Total real time: 84020ms; Average real time: 840.200ms +Total user time: 82254ms; Average user time: 822.540ms +Total system time: 3280ms; Average system time: 32.800ms + +Cycle: +Total real time: 10344ms; Average real time: 103.440ms +Total user time: 9072ms; Average user time: 90.720ms +Total system time: 1428ms; Average system time: 14.280ms + +--- Kotlin --- +Unoptimised: +Total real time: 15281ms; Average real time: 152.810ms +Total user time: 15863ms; Average user time: 158.630ms +Total system time: 2045ms; Average system time: 20.450ms + +Cycle: +Total real time: 6867ms; Average real time: 68.670ms +Total user time: 6662ms; Average user time: 66.620ms +Total system time: 1955ms; Average system time: 19.550ms + +--- Python --- +Unoptimised: +Total real time: 39837ms; Average real time: 39837.000ms +Total user time: 39809ms; Average user time: 39809.000ms +Total system time: 4ms; Average system time: 4.000ms + +Cycle: +Total real time: 2705ms; Average real time: 2705.000ms +Total user time: 2689ms; Average user time: 2689.000ms +Total system time: 4ms; Average system time: 4.000ms + +--- Rust --- +Unoptimised: +Total real time: 24206ms; Average real time: 242.060ms +Total user time: 23937ms; Average user time: 239.370ms +Total system time: 216ms; Average system time: 2.160ms + +Cycle: +Total real time: 305ms; Average real time: 3.050ms +Total user time: 242ms; Average user time: 2.420ms +Total system time: 63ms; Average system time: .630ms + +--- TypeScript --- +Unoptimised: +Total real time: 84279ms; Average real time: 842.790ms +Total user time: 82252ms; Average user time: 822.520ms +Total system time: 3561ms; Average system time: 35.610ms + +Cycle: +Total real time: 10179ms; Average real time: 101.790ms +Total user time: 8971ms; Average user time: 89.710ms +Total system time: 1361ms; Average system time: 13.610ms + +--- Zig --- +Unoptimised: +Total real time: 6033ms; Average real time: 60.330ms +Total user time: 5951ms; Average user time: 59.510ms +Total system time: 68ms; Average system time: .680ms + +Cycle: +Total real time: 302ms; Average real time: 3.020ms +Total user time: 266ms; Average user time: 2.660ms +Total system time: 36ms; Average system time: .360ms + diff --git a/www/scripts/full-benchmark-unbuffered-clean-sourced.sh b/www/scripts/full-benchmark-unbuffered-clean-sourced.sh new file mode 100644 index 0000000..d978c12 --- /dev/null +++ b/www/scripts/full-benchmark-unbuffered-clean-sourced.sh @@ -0,0 +1,194 @@ +#!/bin/bash + +# prepare +source time-aggregation.sh + +cd /home/shared-space-1/presentation/code/ + +# C +printf -- "--- C ---\n" +cd C +make compile &> /dev/null + +printf "Unoptimised:\n" +#(time ./code_unoptimised &>/dev/null) 2>&1 +benchmark 100 ./code_unoptimised + +printf "\n" + +printf "Cycle:\n" +#(time ./code_cycle &>/dev/null) 2>&1 +benchmark 100 ./code_cycle + +printf "\n" + +make clean &> /dev/null +cd .. + +# Go + +printf -- "--- Go ---\n" +cd Go + +printf "Unoptimised:\n" +#(time go run ./code_unoptimised/ &>/dev/null) 2>&1 +benchmark 100 'go run ./code_unoptimised/' + +printf "\n" + +printf "Cycle:\n" +#(time go run ./code_cycle/ &>/dev/null) 2>&1 +benchmark 100 'go run ./code_cycle/' + +printf "\n" + +cd .. + +# Java + +printf -- "--- Java ---\n" +cd Java +make compile &> /dev/null + +printf "Unoptimised:\n" +#(time java code_unoptimised &>/dev/null) 2>&1 +benchmark 100 'java code_unoptimised' + +printf "\n" + +printf "Cycle:\n" +#(time java code_cycle &>/dev/null) 2>&1 +benchmark 100 'java code_cycle' + +printf "\n" + +make clean &> /dev/null +cd .. + +# JavaScript + +printf -- "--- JavaScript ---\n" +cd JavaScript + +printf "Unoptimised:\n" +#(time node code_unoptimised.js &>/dev/null) 2>&1 +benchmark 100 'node code_unoptimised.js' + +printf "\n" + +printf "Cycle:\n" +#(time node code_cycle.js &>/dev/null) 2>&1 +benchmark 100 'node code_cycle.js' + +printf "\n" + +cd .. + +# Kotlin + +printf -- "--- Kotlin ---\n" +cd Kotlin +make compile-on-premise &> /dev/null + +printf "Unoptimised:\n" +#(time java -jar code_unoptimised.jar &>/dev/null) 2>&1 +benchmark 100 'java -jar code_unoptimised.jar' + +printf "\n" + +printf "Cycle:\n" +#(time java -jar code_cycle.jar &>/dev/null) 2>&1 +benchmark 100 'java -jar code_cycle.jar' + +printf "\n" + +make clean &> /dev/null +cd .. + +# Python + +printf -- "--- Python ---\n" +cd Python + +printf "Unoptimised:\n" +#(time python3 code_unoptimised.py &>/dev/null) 2>&1 +benchmark 1 'python3 code_unoptimised.py' + +printf "\n" + +printf "Cycle:\n" +#(time python3 code_cycle.py &>/dev/null) 2>&1 +benchmark 1 'python3 code_cycle.py' + +printf "\n" + +cd .. + +# Rust + +printf -- "--- Rust ---\n" +cd Rust +make compile &> /dev/null + +printf "Unoptimised:\n" +#(time ./code_unoptimised/target/release/code_unoptimised &>/dev/null) 2>&1 +benchmark 100 './code_unoptimised/target/release/code_unoptimised' + +printf "\n" + +printf "Cycle:\n" +#(time ./code_cycle/target/release/code_cycle &>/dev/null) 2>&1 +benchmark 100 './code_cycle/target/release/code_cycle' + +printf "\n" + +make clean &> /dev/null +cd .. + +# TypeScript + +printf -- "--- TypeScript ---\n" +cd TypeScript +# using precompiled version because the local compiler is borked + +printf "Unoptimised:\n" +#(time node code_unoptimised.js &>/dev/null) 2>&1 +benchmark 100 'node code_unoptimised.js' + +printf "\n" + +printf "Cycle:\n" +#(time node code_cycle.js &>/dev/null) 2>&1 +benchmark 100 'node code_cycle.js' + +printf "\n" + +cd .. + +# Zig + +printf -- "--- Zig ---\n" +cd Zig +make compile-on-premise &> /dev/null + +printf "Unoptimised:\n" +#(time ./code_unoptimised/zig-out/bin/code_unoptimised &>/dev/null) 2>&1 +benchmark 100 './code_unoptimised/zig-out/bin/code_unoptimised' + +printf "\n" + +printf "Cycle:\n" +#(time ./code_cycle/zig-out/bin/code_cycle &>/dev/null) 2>&1 +benchmark 100 './code_cycle/zig-out/bin/code_cycle' + +printf "\n" + +make clean &> /dev/null +cd .. + + +# send +#cd /home/shared-space-1/presentation/code/www/scripts/ +#RESULT_STRING=$(cat $TEMP_FILE) +#printf -- "Content-Type: text/plain\r\n\r\n%s" "$RESULT_STRING" +#rm $TEMP_FILE diff --git a/www/scripts/full-benchmark-unbuffered-clean.sh b/www/scripts/full-benchmark-unbuffered-clean.sh new file mode 100644 index 0000000..4ca3697 --- /dev/null +++ b/www/scripts/full-benchmark-unbuffered-clean.sh @@ -0,0 +1,174 @@ +#!/bin/bash + +# prepare +cd /home/shared-space-1/presentation/code/ + +# C +printf -- "--- C ---\n" +cd C +make compile &> /dev/null + +printf "Unoptimised:\n" +(time ./code_unoptimised &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time ./code_cycle &>/dev/null) 2>&1 + +printf "\n" + +make clean &> /dev/null +cd .. + +# Go + +printf -- "--- Go ---\n" +cd Go + +printf "Unoptimised:\n" +(time go run ./code_unoptimised/ &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time go run ./code_cycle/ &>/dev/null) 2>&1 + +printf "\n" + +cd .. + +# Java + +printf -- "--- Java ---\n" +cd Java +make compile &> /dev/null + +printf "Unoptimised:\n" +(time java code_unoptimised &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time java code_cycle &>/dev/null) 2>&1 + +printf "\n" + +make clean &> /dev/null +cd .. + +# JavaScript + +printf -- "--- JavaScript ---\n" +cd JavaScript + +printf "Unoptimised:\n" +(time node code_unoptimised.js &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time node code_cycle.js &>/dev/null) 2>&1 + +printf "\n" + +cd .. + +# Kotlin + +printf -- "--- Kotlin ---\n" +cd Kotlin +make compile-on-premise &> /dev/null + +printf "Unoptimised:\n" +(time java -jar code_unoptimised.jar &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time java -jar code_cycle.jar &>/dev/null) 2>&1 + +printf "\n" + +make clean &> /dev/null +cd .. + +# Python + +printf -- "--- Python ---\n" +cd Python + +printf "Unoptimised:\n" +(time python3 code_unoptimised.py &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time python3 code_cycle.py &>/dev/null) 2>&1 + +printf "\n" + +cd .. + +# Rust + +printf -- "--- Rust ---\n" +cd Rust +make compile &> /dev/null + +printf "Unoptimised:\n" +(time ./code_unoptimised/target/release/code_unoptimised &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time ./code_cycle/target/release/code_cycle &>/dev/null) 2>&1 + +printf "\n" + +make clean &> /dev/null +cd .. + +# TypeScript + +printf -- "--- TypeScript ---\n" +cd TypeScript +# using precompiled version because the local compiler is borked + +printf "Unoptimised:\n" +(time node code_unoptimised.js &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time node code_cycle.js &>/dev/null) 2>&1 + +printf "\n" + +cd .. + +# Zig + +printf -- "--- Zig ---\n" +cd Zig +make compile-on-premise &> /dev/null + +printf "Unoptimised:\n" +(time ./code_unoptimised/zig-out/bin/code_unoptimised &>/dev/null) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time ./code_cycle/zig-out/bin/code_cycle &>/dev/null) 2>&1 + +printf "\n" + +make clean &> /dev/null +cd .. + + +# send +#cd /home/shared-space-1/presentation/code/www/scripts/ +#RESULT_STRING=$(cat $TEMP_FILE) +#printf -- "Content-Type: text/plain\r\n\r\n%s" "$RESULT_STRING" +#rm $TEMP_FILE diff --git a/www/scripts/full-benchmark-unbuffered.sh b/www/scripts/full-benchmark-unbuffered.sh new file mode 100644 index 0000000..2eca87d --- /dev/null +++ b/www/scripts/full-benchmark-unbuffered.sh @@ -0,0 +1,174 @@ +#!/bin/bash + +# prepare +cd /home/shared-space-1/presentation/code/ + +# C +printf -- "--- C ---\n" +cd C +make compile + +printf "Unoptimised:\n" +(time ./code_unoptimised) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time ./code_cycle) 2>&1 + +printf "\n" + +make clean &> /dev/null +cd .. + +# Go + +printf -- "--- Go ---\n" +cd Go + +printf "Unoptimised:\n" +(time go run ./code_unoptimised/) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time go run ./code_cycle/) 2>&1 + +printf "\n" + +cd .. + +# Java + +printf -- "--- Java ---\n" +cd Java +make compile + +printf "Unoptimised:\n" +(time java code_unoptimised) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time java code_cycle) 2>&1 + +printf "\n" + +make clean &> /dev/null +cd .. + +# JavaScript + +printf -- "--- JavaScript ---\n" +cd JavaScript + +printf "Unoptimised:\n" +(time node code_unoptimised.js) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time node code_cycle.js) 2>&1 + +printf "\n" + +cd .. + +# Kotlin + +printf -- "--- Kotlin ---\n" +cd Kotlin +make compile-on-premise &> /dev/null + +printf "Unoptimised:\n" +(time java -jar code_unoptimised.jar) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time java -jar code_cycle.jar) 2>&1 + +printf "\n" + +make clean +cd .. + +# Python + +printf -- "--- Python ---\n" +cd Python + +printf "Unoptimised:\n" +(time python3 code_unoptimised.py) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time python3 code_cycle.py) 2>&1 + +printf "\n" + +cd .. + +# Rust + +printf -- "--- Rust ---\n" +cd Rust +make compile + +printf "Unoptimised:\n" +(time ./code_unoptimised/target/release/code_unoptimised) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time ./code_cycle/target/release/code_cycle) 2>&1 + +printf "\n" + +make clean +cd .. + +# TypeScript + +printf -- "--- TypeScript ---\n" +cd TypeScript +# using precompiled version because the local compiler is borked + +printf "Unoptimised:\n" +(time node code_unoptimised.js) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time node code_cycle.js) 2>&1 + +printf "\n" + +cd .. + +# Zig + +printf -- "--- Zig ---\n" +cd Zig +make compile-on-premise + +printf "Unoptimised:\n" +(time ./code_unoptimised/zig-out/bin/code_unoptimised) 2>&1 + +printf "\n" + +printf "Cycle:\n" +(time ./code_cycle/zig-out/bin/code_cycle) 2>&1 + +printf "\n" + +make clean +cd .. + + +# send +#cd /home/shared-space-1/presentation/code/www/scripts/ +#RESULT_STRING=$(cat $TEMP_FILE) +#printf -- "Content-Type: text/plain\r\n\r\n%s" "$RESULT_STRING" +#rm $TEMP_FILE diff --git a/www/scripts/full-benchmark.sh b/www/scripts/full-benchmark.sh new file mode 100644 index 0000000..c41eebb --- /dev/null +++ b/www/scripts/full-benchmark.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +# prepare +TEMP_FILE=$(uuid) +touch $TEMP_FILE +cd /home/shared-space-1/presentation/code/ + +# C +printf -- "--- C ---\n" >> $TEMP_FILE +cd C +pwd +make compile + +printf "Unoptimised:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +(time ./code_unoptimised) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "Cycle:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +(time ./code_cycle) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +make clean &> /dev/null +cd .. + +# Go + +### empty, needs compiler + +# Java + +printf -- "--- Java ---\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +cd Java +pwd +make compile + +printf "Unoptimised:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +(time java code_unoptimised) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "Cycle:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +(time java code_cycle) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +make clean &> /dev/null +cd .. + +# JavaScript + +printf -- "--- JavaScript ---\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +cd JavaScript + +printf "Unoptimised:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +(time node code_unoptimised.js) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "Cycle:\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE +(time node code_cycle.js) &>> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +printf "\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +cd .. + +# Kotlin + +printf -- "--- Kotlin ---\n" >> /home/shared-space-1/presentation/code/www/scripts/$TEMP_FILE + +# send +cd /home/shared-space-1/presentation/code/www/scripts/ +RESULT_STRING=$(cat $TEMP_FILE) +printf -- "Content-Type: text/plain\r\n\r\n%s" "$RESULT_STRING" +rm $TEMP_FILE diff --git a/www/scripts/python-cycle-2023-10-14_16-29-18.bench b/www/scripts/python-cycle-2023-10-14_16-29-18.bench new file mode 100644 index 0000000..b4d0726 --- /dev/null +++ b/www/scripts/python-cycle-2023-10-14_16-29-18.bench @@ -0,0 +1,504 @@ +001/100 python3 ../../Python/code_cycle.py +Total real time: 2435ms; Average real time: 2435.000ms +Total user time: 2423ms; Average user time: 2423.000ms +Total system time: 8ms; Average system time: 8.000ms + +002/100 python3 ../../Python/code_cycle.py +Total real time: 5048ms; Average real time: 2524.000ms +Total user time: 5029ms; Average user time: 2514.500ms +Total system time: 12ms; Average system time: 6.000ms + +003/100 python3 ../../Python/code_cycle.py +Total real time: 7625ms; Average real time: 2541.666ms +Total user time: 7588ms; Average user time: 2529.333ms +Total system time: 24ms; Average system time: 8.000ms + +004/100 python3 ../../Python/code_cycle.py +Total real time: 10240ms; Average real time: 2560.000ms +Total user time: 10193ms; Average user time: 2548.250ms +Total system time: 32ms; Average system time: 8.000ms + +005/100 python3 ../../Python/code_cycle.py +Total real time: 12813ms; Average real time: 2562.600ms +Total user time: 12746ms; Average user time: 2549.200ms +Total system time: 44ms; Average system time: 8.800ms + +006/100 python3 ../../Python/code_cycle.py +Total real time: 15260ms; Average real time: 2543.333ms +Total user time: 15188ms; Average user time: 2531.333ms +Total system time: 44ms; Average system time: 7.333ms + +007/100 python3 ../../Python/code_cycle.py +Total real time: 17733ms; Average real time: 2533.285ms +Total user time: 17655ms; Average user time: 2522.142ms +Total system time: 44ms; Average system time: 6.285ms + +008/100 python3 ../../Python/code_cycle.py +Total real time: 20446ms; Average real time: 2555.750ms +Total user time: 20359ms; Average user time: 2544.875ms +Total system time: 48ms; Average system time: 6.000ms + +009/100 python3 ../../Python/code_cycle.py +Total real time: 22976ms; Average real time: 2552.888ms +Total user time: 22880ms; Average user time: 2542.222ms +Total system time: 52ms; Average system time: 5.777ms + +010/100 python3 ../../Python/code_cycle.py +Total real time: 25530ms; Average real time: 2553.000ms +Total user time: 25425ms; Average user time: 2542.500ms +Total system time: 56ms; Average system time: 5.600ms + +011/100 python3 ../../Python/code_cycle.py +Total real time: 28046ms; Average real time: 2549.636ms +Total user time: 27939ms; Average user time: 2539.909ms +Total system time: 56ms; Average system time: 5.090ms + +012/100 python3 ../../Python/code_cycle.py +Total real time: 30615ms; Average real time: 2551.250ms +Total user time: 30499ms; Average user time: 2541.583ms +Total system time: 60ms; Average system time: 5.000ms + +013/100 python3 ../../Python/code_cycle.py +Total real time: 33075ms; Average real time: 2544.230ms +Total user time: 32957ms; Average user time: 2535.153ms +Total system time: 60ms; Average system time: 4.615ms + +014/100 python3 ../../Python/code_cycle.py +Total real time: 35542ms; Average real time: 2538.714ms +Total user time: 35413ms; Average user time: 2529.500ms +Total system time: 68ms; Average system time: 4.857ms + +015/100 python3 ../../Python/code_cycle.py +Total real time: 37943ms; Average real time: 2529.533ms +Total user time: 37807ms; Average user time: 2520.466ms +Total system time: 72ms; Average system time: 4.800ms + +016/100 python3 ../../Python/code_cycle.py +Total real time: 40735ms; Average real time: 2545.937ms +Total user time: 40587ms; Average user time: 2536.687ms +Total system time: 80ms; Average system time: 5.000ms + +017/100 python3 ../../Python/code_cycle.py +Total real time: 43240ms; Average real time: 2543.529ms +Total user time: 43088ms; Average user time: 2534.588ms +Total system time: 80ms; Average system time: 4.705ms + +018/100 python3 ../../Python/code_cycle.py +Total real time: 45842ms; Average real time: 2546.777ms +Total user time: 45682ms; Average user time: 2537.888ms +Total system time: 84ms; Average system time: 4.666ms + +019/100 python3 ../../Python/code_cycle.py +Total real time: 48534ms; Average real time: 2554.421ms +Total user time: 48363ms; Average user time: 2545.421ms +Total system time: 92ms; Average system time: 4.842ms + +020/100 python3 ../../Python/code_cycle.py +Total real time: 51137ms; Average real time: 2556.850ms +Total user time: 50949ms; Average user time: 2547.450ms +Total system time: 100ms; Average system time: 5.000ms + +021/100 python3 ../../Python/code_cycle.py +Total real time: 53656ms; Average real time: 2555.047ms +Total user time: 53458ms; Average user time: 2545.619ms +Total system time: 108ms; Average system time: 5.142ms + +022/100 python3 ../../Python/code_cycle.py +Total real time: 56303ms; Average real time: 2559.227ms +Total user time: 56095ms; Average user time: 2549.772ms +Total system time: 116ms; Average system time: 5.272ms + +023/100 python3 ../../Python/code_cycle.py +Total real time: 58721ms; Average real time: 2553.086ms +Total user time: 58512ms; Average user time: 2544.000ms +Total system time: 116ms; Average system time: 5.043ms + +024/100 python3 ../../Python/code_cycle.py +Total real time: 61225ms; Average real time: 2551.041ms +Total user time: 61003ms; Average user time: 2541.791ms +Total system time: 124ms; Average system time: 5.166ms + +025/100 python3 ../../Python/code_cycle.py +Total real time: 63685ms; Average real time: 2547.400ms +Total user time: 63458ms; Average user time: 2538.320ms +Total system time: 128ms; Average system time: 5.120ms + +026/100 python3 ../../Python/code_cycle.py +Total real time: 66141ms; Average real time: 2543.884ms +Total user time: 65909ms; Average user time: 2534.961ms +Total system time: 128ms; Average system time: 4.923ms + +027/100 python3 ../../Python/code_cycle.py +Total real time: 68678ms; Average real time: 2543.629ms +Total user time: 68435ms; Average user time: 2534.629ms +Total system time: 132ms; Average system time: 4.888ms + +028/100 python3 ../../Python/code_cycle.py +Total real time: 71138ms; Average real time: 2540.642ms +Total user time: 70880ms; Average user time: 2531.428ms +Total system time: 140ms; Average system time: 5.000ms + +029/100 python3 ../../Python/code_cycle.py +Total real time: 73682ms; Average real time: 2540.758ms +Total user time: 73419ms; Average user time: 2531.689ms +Total system time: 144ms; Average system time: 4.965ms + +030/100 python3 ../../Python/code_cycle.py +Total real time: 76167ms; Average real time: 2538.900ms +Total user time: 75895ms; Average user time: 2529.833ms +Total system time: 152ms; Average system time: 5.066ms + +031/100 python3 ../../Python/code_cycle.py +Total real time: 78585ms; Average real time: 2535.000ms +Total user time: 78301ms; Average user time: 2525.838ms +Total system time: 160ms; Average system time: 5.161ms + +032/100 python3 ../../Python/code_cycle.py +Total real time: 81110ms; Average real time: 2534.687ms +Total user time: 80812ms; Average user time: 2525.375ms +Total system time: 172ms; Average system time: 5.375ms + +033/100 python3 ../../Python/code_cycle.py +Total real time: 83653ms; Average real time: 2534.939ms +Total user time: 83338ms; Average user time: 2525.393ms +Total system time: 180ms; Average system time: 5.454ms + +034/100 python3 ../../Python/code_cycle.py +Total real time: 86302ms; Average real time: 2538.294ms +Total user time: 85970ms; Average user time: 2528.529ms +Total system time: 192ms; Average system time: 5.647ms + +035/100 python3 ../../Python/code_cycle.py +Total real time: 88781ms; Average real time: 2536.600ms +Total user time: 88441ms; Average user time: 2526.885ms +Total system time: 200ms; Average system time: 5.714ms + +036/100 python3 ../../Python/code_cycle.py +Total real time: 91192ms; Average real time: 2533.111ms +Total user time: 90849ms; Average user time: 2523.583ms +Total system time: 200ms; Average system time: 5.555ms + +037/100 python3 ../../Python/code_cycle.py +Total real time: 93673ms; Average real time: 2531.702ms +Total user time: 93324ms; Average user time: 2522.270ms +Total system time: 204ms; Average system time: 5.513ms + +038/100 python3 ../../Python/code_cycle.py +Total real time: 96110ms; Average real time: 2529.210ms +Total user time: 95756ms; Average user time: 2519.894ms +Total system time: 208ms; Average system time: 5.473ms + +039/100 python3 ../../Python/code_cycle.py +Total real time: 98553ms; Average real time: 2527.000ms +Total user time: 98194ms; Average user time: 2517.794ms +Total system time: 212ms; Average system time: 5.435ms + +040/100 python3 ../../Python/code_cycle.py +Total real time: 100952ms; Average real time: 2523.800ms +Total user time: 100584ms; Average user time: 2514.600ms +Total system time: 213ms; Average system time: 5.325ms + +041/100 python3 ../../Python/code_cycle.py +Total real time: 103479ms; Average real time: 2523.878ms +Total user time: 103100ms; Average user time: 2514.634ms +Total system time: 221ms; Average system time: 5.390ms + +042/100 python3 ../../Python/code_cycle.py +Total real time: 105950ms; Average real time: 2522.619ms +Total user time: 105553ms; Average user time: 2513.166ms +Total system time: 229ms; Average system time: 5.452ms + +043/100 python3 ../../Python/code_cycle.py +Total real time: 108408ms; Average real time: 2521.116ms +Total user time: 108004ms; Average user time: 2511.720ms +Total system time: 233ms; Average system time: 5.418ms + +044/100 python3 ../../Python/code_cycle.py +Total real time: 110855ms; Average real time: 2519.431ms +Total user time: 110444ms; Average user time: 2510.090ms +Total system time: 237ms; Average system time: 5.386ms + +045/100 python3 ../../Python/code_cycle.py +Total real time: 113509ms; Average real time: 2522.422ms +Total user time: 113084ms; Average user time: 2512.977ms +Total system time: 241ms; Average system time: 5.355ms + +046/100 python3 ../../Python/code_cycle.py +Total real time: 116061ms; Average real time: 2523.065ms +Total user time: 115625ms; Average user time: 2513.586ms +Total system time: 246ms; Average system time: 5.347ms + +047/100 python3 ../../Python/code_cycle.py +Total real time: 118641ms; Average real time: 2524.276ms +Total user time: 118195ms; Average user time: 2514.787ms +Total system time: 254ms; Average system time: 5.404ms + +048/100 python3 ../../Python/code_cycle.py +Total real time: 121148ms; Average real time: 2523.916ms +Total user time: 120689ms; Average user time: 2514.354ms +Total system time: 262ms; Average system time: 5.458ms + +049/100 python3 ../../Python/code_cycle.py +Total real time: 123719ms; Average real time: 2524.877ms +Total user time: 123258ms; Average user time: 2515.469ms +Total system time: 262ms; Average system time: 5.346ms + +050/100 python3 ../../Python/code_cycle.py +Total real time: 126131ms; Average real time: 2522.620ms +Total user time: 125658ms; Average user time: 2513.160ms +Total system time: 266ms; Average system time: 5.320ms + +051/100 python3 ../../Python/code_cycle.py +Total real time: 128568ms; Average real time: 2520.941ms +Total user time: 128084ms; Average user time: 2511.450ms +Total system time: 274ms; Average system time: 5.372ms + +052/100 python3 ../../Python/code_cycle.py +Total real time: 131004ms; Average real time: 2519.307ms +Total user time: 130510ms; Average user time: 2509.807ms +Total system time: 282ms; Average system time: 5.423ms + +053/100 python3 ../../Python/code_cycle.py +Total real time: 133598ms; Average real time: 2520.716ms +Total user time: 133091ms; Average user time: 2511.150ms +Total system time: 294ms; Average system time: 5.547ms + +054/100 python3 ../../Python/code_cycle.py +Total real time: 136044ms; Average real time: 2519.333ms +Total user time: 135528ms; Average user time: 2509.777ms +Total system time: 302ms; Average system time: 5.592ms + +055/100 python3 ../../Python/code_cycle.py +Total real time: 138577ms; Average real time: 2519.581ms +Total user time: 138049ms; Average user time: 2509.981ms +Total system time: 306ms; Average system time: 5.563ms + +056/100 python3 ../../Python/code_cycle.py +Total real time: 141097ms; Average real time: 2519.589ms +Total user time: 140561ms; Average user time: 2510.017ms +Total system time: 306ms; Average system time: 5.464ms + +057/100 python3 ../../Python/code_cycle.py +Total real time: 143546ms; Average real time: 2518.350ms +Total user time: 142990ms; Average user time: 2508.596ms +Total system time: 318ms; Average system time: 5.578ms + +058/100 python3 ../../Python/code_cycle.py +Total real time: 146005ms; Average real time: 2517.327ms +Total user time: 145446ms; Average user time: 2507.689ms +Total system time: 318ms; Average system time: 5.482ms + +059/100 python3 ../../Python/code_cycle.py +Total real time: 148505ms; Average real time: 2517.033ms +Total user time: 147941ms; Average user time: 2507.474ms +Total system time: 322ms; Average system time: 5.457ms + +060/100 python3 ../../Python/code_cycle.py +Total real time: 150955ms; Average real time: 2515.916ms +Total user time: 150379ms; Average user time: 2506.316ms +Total system time: 326ms; Average system time: 5.433ms + +061/100 python3 ../../Python/code_cycle.py +Total real time: 153584ms; Average real time: 2517.770ms +Total user time: 153003ms; Average user time: 2508.245ms +Total system time: 327ms; Average system time: 5.360ms + +062/100 python3 ../../Python/code_cycle.py +Total real time: 156128ms; Average real time: 2518.193ms +Total user time: 155546ms; Average user time: 2508.806ms +Total system time: 327ms; Average system time: 5.274ms + +063/100 python3 ../../Python/code_cycle.py +Total real time: 158803ms; Average real time: 2520.682ms +Total user time: 158211ms; Average user time: 2511.285ms +Total system time: 335ms; Average system time: 5.317ms + +064/100 python3 ../../Python/code_cycle.py +Total real time: 161317ms; Average real time: 2520.578ms +Total user time: 160714ms; Average user time: 2511.156ms +Total system time: 339ms; Average system time: 5.296ms + +065/100 python3 ../../Python/code_cycle.py +Total real time: 163861ms; Average real time: 2520.938ms +Total user time: 163250ms; Average user time: 2511.538ms +Total system time: 343ms; Average system time: 5.276ms + +066/100 python3 ../../Python/code_cycle.py +Total real time: 166391ms; Average real time: 2521.075ms +Total user time: 165759ms; Average user time: 2511.500ms +Total system time: 351ms; Average system time: 5.318ms + +067/100 python3 ../../Python/code_cycle.py +Total real time: 168862ms; Average real time: 2520.328ms +Total user time: 168226ms; Average user time: 2510.835ms +Total system time: 351ms; Average system time: 5.238ms + +068/100 python3 ../../Python/code_cycle.py +Total real time: 171353ms; Average real time: 2519.897ms +Total user time: 170694ms; Average user time: 2510.205ms +Total system time: 363ms; Average system time: 5.338ms + +069/100 python3 ../../Python/code_cycle.py +Total real time: 173926ms; Average real time: 2520.666ms +Total user time: 173251ms; Average user time: 2510.884ms +Total system time: 372ms; Average system time: 5.391ms + +070/100 python3 ../../Python/code_cycle.py +Total real time: 176433ms; Average real time: 2520.471ms +Total user time: 175751ms; Average user time: 2510.728ms +Total system time: 372ms; Average system time: 5.314ms + +071/100 python3 ../../Python/code_cycle.py +Total real time: 178983ms; Average real time: 2520.887ms +Total user time: 178299ms; Average user time: 2511.253ms +Total system time: 372ms; Average system time: 5.239ms + +072/100 python3 ../../Python/code_cycle.py +Total real time: 181524ms; Average real time: 2521.166ms +Total user time: 180834ms; Average user time: 2511.583ms +Total system time: 372ms; Average system time: 5.166ms + +073/100 python3 ../../Python/code_cycle.py +Total real time: 183940ms; Average real time: 2519.726ms +Total user time: 183236ms; Average user time: 2510.082ms +Total system time: 380ms; Average system time: 5.205ms + +074/100 python3 ../../Python/code_cycle.py +Total real time: 186435ms; Average real time: 2519.391ms +Total user time: 185721ms; Average user time: 2509.743ms +Total system time: 384ms; Average system time: 5.189ms + +075/100 python3 ../../Python/code_cycle.py +Total real time: 188873ms; Average real time: 2518.306ms +Total user time: 188157ms; Average user time: 2508.760ms +Total system time: 384ms; Average system time: 5.120ms + +076/100 python3 ../../Python/code_cycle.py +Total real time: 191342ms; Average real time: 2517.657ms +Total user time: 190621ms; Average user time: 2508.171ms +Total system time: 384ms; Average system time: 5.052ms + +077/100 python3 ../../Python/code_cycle.py +Total real time: 193927ms; Average real time: 2518.532ms +Total user time: 193202ms; Average user time: 2509.116ms +Total system time: 384ms; Average system time: 4.987ms + +078/100 python3 ../../Python/code_cycle.py +Total real time: 196517ms; Average real time: 2519.448ms +Total user time: 195786ms; Average user time: 2510.076ms +Total system time: 384ms; Average system time: 4.923ms + +079/100 python3 ../../Python/code_cycle.py +Total real time: 199043ms; Average real time: 2519.531ms +Total user time: 198294ms; Average user time: 2510.050ms +Total system time: 396ms; Average system time: 5.012ms + +080/100 python3 ../../Python/code_cycle.py +Total real time: 201612ms; Average real time: 2520.150ms +Total user time: 200848ms; Average user time: 2510.600ms +Total system time: 404ms; Average system time: 5.050ms + +081/100 python3 ../../Python/code_cycle.py +Total real time: 204115ms; Average real time: 2519.938ms +Total user time: 203343ms; Average user time: 2510.407ms +Total system time: 408ms; Average system time: 5.037ms + +082/100 python3 ../../Python/code_cycle.py +Total real time: 206561ms; Average real time: 2519.036ms +Total user time: 205783ms; Average user time: 2509.548ms +Total system time: 412ms; Average system time: 5.024ms + +083/100 python3 ../../Python/code_cycle.py +Total real time: 209120ms; Average real time: 2519.518ms +Total user time: 208333ms; Average user time: 2510.036ms +Total system time: 416ms; Average system time: 5.012ms + +084/100 python3 ../../Python/code_cycle.py +Total real time: 211675ms; Average real time: 2519.940ms +Total user time: 210873ms; Average user time: 2510.392ms +Total system time: 428ms; Average system time: 5.095ms + +085/100 python3 ../../Python/code_cycle.py +Total real time: 214106ms; Average real time: 2518.894ms +Total user time: 213296ms; Average user time: 2509.364ms +Total system time: 432ms; Average system time: 5.082ms + +086/100 python3 ../../Python/code_cycle.py +Total real time: 216636ms; Average real time: 2519.023ms +Total user time: 215814ms; Average user time: 2509.465ms +Total system time: 440ms; Average system time: 5.116ms + +087/100 python3 ../../Python/code_cycle.py +Total real time: 219169ms; Average real time: 2519.183ms +Total user time: 218336ms; Average user time: 2509.609ms +Total system time: 448ms; Average system time: 5.149ms + +088/100 python3 ../../Python/code_cycle.py +Total real time: 221621ms; Average real time: 2518.420ms +Total user time: 220771ms; Average user time: 2508.761ms +Total system time: 460ms; Average system time: 5.227ms + +089/100 python3 ../../Python/code_cycle.py +Total real time: 224259ms; Average real time: 2519.764ms +Total user time: 223403ms; Average user time: 2510.146ms +Total system time: 464ms; Average system time: 5.213ms + +090/100 python3 ../../Python/code_cycle.py +Total real time: 226773ms; Average real time: 2519.700ms +Total user time: 225903ms; Average user time: 2510.033ms +Total system time: 476ms; Average system time: 5.288ms + +091/100 python3 ../../Python/code_cycle.py +Total real time: 229193ms; Average real time: 2518.604ms +Total user time: 228318ms; Average user time: 2508.989ms +Total system time: 480ms; Average system time: 5.274ms + +092/100 python3 ../../Python/code_cycle.py +Total real time: 231860ms; Average real time: 2520.217ms +Total user time: 230973ms; Average user time: 2510.576ms +Total system time: 480ms; Average system time: 5.217ms + +093/100 python3 ../../Python/code_cycle.py +Total real time: 234259ms; Average real time: 2518.913ms +Total user time: 233364ms; Average user time: 2509.290ms +Total system time: 484ms; Average system time: 5.204ms + +094/100 python3 ../../Python/code_cycle.py +Total real time: 236747ms; Average real time: 2518.585ms +Total user time: 235843ms; Average user time: 2508.968ms +Total system time: 488ms; Average system time: 5.191ms + +095/100 python3 ../../Python/code_cycle.py +Total real time: 239248ms; Average real time: 2518.400ms +Total user time: 238332ms; Average user time: 2508.757ms +Total system time: 496ms; Average system time: 5.221ms + +096/100 python3 ../../Python/code_cycle.py +Total real time: 241670ms; Average real time: 2517.395ms +Total user time: 240743ms; Average user time: 2507.739ms +Total system time: 504ms; Average system time: 5.250ms + +097/100 python3 ../../Python/code_cycle.py +Total real time: 244138ms; Average real time: 2516.886ms +Total user time: 243206ms; Average user time: 2507.278ms +Total system time: 508ms; Average system time: 5.237ms + +098/100 python3 ../../Python/code_cycle.py +Total real time: 246569ms; Average real time: 2516.010ms +Total user time: 245632ms; Average user time: 2506.448ms +Total system time: 512ms; Average system time: 5.224ms + +099/100 python3 ../../Python/code_cycle.py +Total real time: 249065ms; Average real time: 2515.808ms +Total user time: 248113ms; Average user time: 2506.191ms +Total system time: 524ms; Average system time: 5.292ms + +100/100 python3 ../../Python/code_cycle.py +Total real time: 251523ms; Average real time: 2515.230ms +Total user time: 250538ms; Average user time: 2505.380ms +Total system time: 544ms; Average system time: 5.440ms + + +Total real time: 251523ms; Average real time: 2515.230ms +Total user time: 250538ms; Average user time: 2505.380ms +Total system time: 544ms; Average system time: 5.440ms diff --git a/www/scripts/python-unoptimised-2023-10-14_14-48-43.bench b/www/scripts/python-unoptimised-2023-10-14_14-48-43.bench new file mode 100644 index 0000000..2bb226e --- /dev/null +++ b/www/scripts/python-unoptimised-2023-10-14_14-48-43.bench @@ -0,0 +1,504 @@ +001/100 python3 ../../Python/code_unoptimised.py +Total real time: 40033ms; Average real time: 40033.000ms +Total user time: 40007ms; Average user time: 40007.000ms +Total system time: 4ms; Average system time: 4.000ms + +002/100 python3 ../../Python/code_unoptimised.py +Total real time: 79729ms; Average real time: 39864.500ms +Total user time: 79662ms; Average user time: 39831.000ms +Total system time: 16ms; Average system time: 8.000ms + +003/100 python3 ../../Python/code_unoptimised.py +Total real time: 119789ms; Average real time: 39929.666ms +Total user time: 119611ms; Average user time: 39870.333ms +Total system time: 40ms; Average system time: 13.333ms + +004/100 python3 ../../Python/code_unoptimised.py +Total real time: 159491ms; Average real time: 39872.750ms +Total user time: 159288ms; Average user time: 39822.000ms +Total system time: 48ms; Average system time: 12.000ms + +005/100 python3 ../../Python/code_unoptimised.py +Total real time: 199242ms; Average real time: 39848.400ms +Total user time: 198941ms; Average user time: 39788.200ms +Total system time: 76ms; Average system time: 15.200ms + +006/100 python3 ../../Python/code_unoptimised.py +Total real time: 238746ms; Average real time: 39791.000ms +Total user time: 238418ms; Average user time: 39736.333ms +Total system time: 80ms; Average system time: 13.333ms + +007/100 python3 ../../Python/code_unoptimised.py +Total real time: 278303ms; Average real time: 39757.571ms +Total user time: 277940ms; Average user time: 39705.714ms +Total system time: 84ms; Average system time: 12.000ms + +008/100 python3 ../../Python/code_unoptimised.py +Total real time: 317729ms; Average real time: 39716.125ms +Total user time: 317314ms; Average user time: 39664.250ms +Total system time: 88ms; Average system time: 11.000ms + +009/100 python3 ../../Python/code_unoptimised.py +Total real time: 358649ms; Average real time: 39849.888ms +Total user time: 358199ms; Average user time: 39799.888ms +Total system time: 93ms; Average system time: 10.333ms + +010/100 python3 ../../Python/code_unoptimised.py +Total real time: 399284ms; Average real time: 39928.400ms +Total user time: 398753ms; Average user time: 39875.300ms +Total system time: 110ms; Average system time: 11.000ms + +011/100 python3 ../../Python/code_unoptimised.py +Total real time: 439475ms; Average real time: 39952.272ms +Total user time: 438883ms; Average user time: 39898.454ms +Total system time: 119ms; Average system time: 10.818ms + +012/100 python3 ../../Python/code_unoptimised.py +Total real time: 478921ms; Average real time: 39910.083ms +Total user time: 478261ms; Average user time: 39855.083ms +Total system time: 136ms; Average system time: 11.333ms + +013/100 python3 ../../Python/code_unoptimised.py +Total real time: 519004ms; Average real time: 39923.384ms +Total user time: 518290ms; Average user time: 39868.461ms +Total system time: 148ms; Average system time: 11.384ms + +014/100 python3 ../../Python/code_unoptimised.py +Total real time: 558513ms; Average real time: 39893.785ms +Total user time: 557753ms; Average user time: 39839.500ms +Total system time: 161ms; Average system time: 11.500ms + +015/100 python3 ../../Python/code_unoptimised.py +Total real time: 598295ms; Average real time: 39886.333ms +Total user time: 597494ms; Average user time: 39832.933ms +Total system time: 178ms; Average system time: 11.866ms + +016/100 python3 ../../Python/code_unoptimised.py +Total real time: 637975ms; Average real time: 39873.437ms +Total user time: 637135ms; Average user time: 39820.937ms +Total system time: 191ms; Average system time: 11.937ms + +017/100 python3 ../../Python/code_unoptimised.py +Total real time: 678116ms; Average real time: 39889.176ms +Total user time: 677249ms; Average user time: 39838.176ms +Total system time: 195ms; Average system time: 11.470ms + +018/100 python3 ../../Python/code_unoptimised.py +Total real time: 718004ms; Average real time: 39889.111ms +Total user time: 717112ms; Average user time: 39839.555ms +Total system time: 199ms; Average system time: 11.055ms + +019/100 python3 ../../Python/code_unoptimised.py +Total real time: 758126ms; Average real time: 39901.368ms +Total user time: 757228ms; Average user time: 39854.105ms +Total system time: 199ms; Average system time: 10.473ms + +020/100 python3 ../../Python/code_unoptimised.py +Total real time: 798379ms; Average real time: 39918.950ms +Total user time: 797425ms; Average user time: 39871.250ms +Total system time: 212ms; Average system time: 10.600ms + +021/100 python3 ../../Python/code_unoptimised.py +Total real time: 838080ms; Average real time: 39908.571ms +Total user time: 837054ms; Average user time: 39859.714ms +Total system time: 224ms; Average system time: 10.666ms + +022/100 python3 ../../Python/code_unoptimised.py +Total real time: 877919ms; Average real time: 39905.409ms +Total user time: 876854ms; Average user time: 39857.000ms +Total system time: 232ms; Average system time: 10.545ms + +023/100 python3 ../../Python/code_unoptimised.py +Total real time: 917430ms; Average real time: 39888.260ms +Total user time: 916344ms; Average user time: 39841.043ms +Total system time: 236ms; Average system time: 10.260ms + +024/100 python3 ../../Python/code_unoptimised.py +Total real time: 957991ms; Average real time: 39916.291ms +Total user time: 956871ms; Average user time: 39869.625ms +Total system time: 240ms; Average system time: 10.000ms + +025/100 python3 ../../Python/code_unoptimised.py +Total real time: 997586ms; Average real time: 39903.440ms +Total user time: 996379ms; Average user time: 39855.160ms +Total system time: 248ms; Average system time: 9.920ms + +026/100 python3 ../../Python/code_unoptimised.py +Total real time: 1036938ms; Average real time: 39882.230ms +Total user time: 1035704ms; Average user time: 39834.769ms +Total system time: 260ms; Average system time: 10.000ms + +027/100 python3 ../../Python/code_unoptimised.py +Total real time: 1076897ms; Average real time: 39885.074ms +Total user time: 1075647ms; Average user time: 39838.777ms +Total system time: 268ms; Average system time: 9.925ms + +028/100 python3 ../../Python/code_unoptimised.py +Total real time: 1116697ms; Average real time: 39882.035ms +Total user time: 1115360ms; Average user time: 39834.285ms +Total system time: 292ms; Average system time: 10.428ms + +029/100 python3 ../../Python/code_unoptimised.py +Total real time: 1156331ms; Average real time: 39873.482ms +Total user time: 1154938ms; Average user time: 39825.448ms +Total system time: 304ms; Average system time: 10.482ms + +030/100 python3 ../../Python/code_unoptimised.py +Total real time: 1195346ms; Average real time: 39844.866ms +Total user time: 1193936ms; Average user time: 39797.866ms +Total system time: 312ms; Average system time: 10.400ms + +031/100 python3 ../../Python/code_unoptimised.py +Total real time: 1235155ms; Average real time: 39843.709ms +Total user time: 1233693ms; Average user time: 39796.548ms +Total system time: 320ms; Average system time: 10.322ms + +032/100 python3 ../../Python/code_unoptimised.py +Total real time: 1274682ms; Average real time: 39833.812ms +Total user time: 1273189ms; Average user time: 39787.156ms +Total system time: 328ms; Average system time: 10.250ms + +033/100 python3 ../../Python/code_unoptimised.py +Total real time: 1314789ms; Average real time: 39842.090ms +Total user time: 1313279ms; Average user time: 39796.333ms +Total system time: 336ms; Average system time: 10.181ms + +034/100 python3 ../../Python/code_unoptimised.py +Total real time: 1354294ms; Average real time: 39832.176ms +Total user time: 1352760ms; Average user time: 39787.058ms +Total system time: 352ms; Average system time: 10.352ms + +035/100 python3 ../../Python/code_unoptimised.py +Total real time: 1393932ms; Average real time: 39826.628ms +Total user time: 1392374ms; Average user time: 39782.114ms +Total system time: 360ms; Average system time: 10.285ms + +036/100 python3 ../../Python/code_unoptimised.py +Total real time: 1433516ms; Average real time: 39819.888ms +Total user time: 1431931ms; Average user time: 39775.861ms +Total system time: 372ms; Average system time: 10.333ms + +037/100 python3 ../../Python/code_unoptimised.py +Total real time: 1473467ms; Average real time: 39823.432ms +Total user time: 1471821ms; Average user time: 39778.945ms +Total system time: 384ms; Average system time: 10.378ms + +038/100 python3 ../../Python/code_unoptimised.py +Total real time: 1513479ms; Average real time: 39828.394ms +Total user time: 1511771ms; Average user time: 39783.447ms +Total system time: 404ms; Average system time: 10.631ms + +039/100 python3 ../../Python/code_unoptimised.py +Total real time: 1553995ms; Average real time: 39846.025ms +Total user time: 1552200ms; Average user time: 39800.000ms +Total system time: 424ms; Average system time: 10.871ms + +040/100 python3 ../../Python/code_unoptimised.py +Total real time: 1594031ms; Average real time: 39850.775ms +Total user time: 1592187ms; Average user time: 39804.675ms +Total system time: 436ms; Average system time: 10.900ms + +041/100 python3 ../../Python/code_unoptimised.py +Total real time: 1633909ms; Average real time: 39851.439ms +Total user time: 1632032ms; Average user time: 39805.658ms +Total system time: 445ms; Average system time: 10.853ms + +042/100 python3 ../../Python/code_unoptimised.py +Total real time: 1674370ms; Average real time: 39865.952ms +Total user time: 1672471ms; Average user time: 39820.738ms +Total system time: 457ms; Average system time: 10.880ms + +043/100 python3 ../../Python/code_unoptimised.py +Total real time: 1714608ms; Average real time: 39874.604ms +Total user time: 1712628ms; Average user time: 39828.558ms +Total system time: 482ms; Average system time: 11.209ms + +044/100 python3 ../../Python/code_unoptimised.py +Total real time: 1754997ms; Average real time: 39886.295ms +Total user time: 1752937ms; Average user time: 39839.477ms +Total system time: 499ms; Average system time: 11.340ms + +045/100 python3 ../../Python/code_unoptimised.py +Total real time: 1796280ms; Average real time: 39917.333ms +Total user time: 1794178ms; Average user time: 39870.622ms +Total system time: 499ms; Average system time: 11.088ms + +046/100 python3 ../../Python/code_unoptimised.py +Total real time: 1836486ms; Average real time: 39923.608ms +Total user time: 1834334ms; Average user time: 39876.826ms +Total system time: 499ms; Average system time: 10.847ms + +047/100 python3 ../../Python/code_unoptimised.py +Total real time: 1877118ms; Average real time: 39938.680ms +Total user time: 1874847ms; Average user time: 39890.361ms +Total system time: 511ms; Average system time: 10.872ms + +048/100 python3 ../../Python/code_unoptimised.py +Total real time: 1917323ms; Average real time: 39944.229ms +Total user time: 1914986ms; Average user time: 39895.541ms +Total system time: 531ms; Average system time: 11.062ms + +049/100 python3 ../../Python/code_unoptimised.py +Total real time: 1957490ms; Average real time: 39948.775ms +Total user time: 1955080ms; Average user time: 39899.591ms +Total system time: 551ms; Average system time: 11.244ms + +050/100 python3 ../../Python/code_unoptimised.py +Total real time: 1997511ms; Average real time: 39950.220ms +Total user time: 1995026ms; Average user time: 39900.520ms +Total system time: 560ms; Average system time: 11.200ms + +051/100 python3 ../../Python/code_unoptimised.py +Total real time: 2037856ms; Average real time: 39957.960ms +Total user time: 2035299ms; Average user time: 39907.823ms +Total system time: 581ms; Average system time: 11.392ms + +052/100 python3 ../../Python/code_unoptimised.py +Total real time: 2077468ms; Average real time: 39951.307ms +Total user time: 2074872ms; Average user time: 39901.384ms +Total system time: 585ms; Average system time: 11.250ms + +053/100 python3 ../../Python/code_unoptimised.py +Total real time: 2117372ms; Average real time: 39950.415ms +Total user time: 2114730ms; Average user time: 39900.566ms +Total system time: 597ms; Average system time: 11.264ms + +054/100 python3 ../../Python/code_unoptimised.py +Total real time: 2157632ms; Average real time: 39956.148ms +Total user time: 2154958ms; Average user time: 39906.629ms +Total system time: 605ms; Average system time: 11.203ms + +055/100 python3 ../../Python/code_unoptimised.py +Total real time: 2198283ms; Average real time: 39968.781ms +Total user time: 2195542ms; Average user time: 39918.945ms +Total system time: 613ms; Average system time: 11.145ms + +056/100 python3 ../../Python/code_unoptimised.py +Total real time: 2239605ms; Average real time: 39992.946ms +Total user time: 2236350ms; Average user time: 39934.821ms +Total system time: 725ms; Average system time: 12.946ms + +057/100 python3 ../../Python/code_unoptimised.py +Total real time: 2280245ms; Average real time: 40004.298ms +Total user time: 2276756ms; Average user time: 39943.087ms +Total system time: 785ms; Average system time: 13.771ms + +058/100 python3 ../../Python/code_unoptimised.py +Total real time: 2320106ms; Average real time: 40001.827ms +Total user time: 2316575ms; Average user time: 39940.948ms +Total system time: 793ms; Average system time: 13.672ms + +059/100 python3 ../../Python/code_unoptimised.py +Total real time: 2360735ms; Average real time: 40012.457ms +Total user time: 2357144ms; Average user time: 39951.593ms +Total system time: 813ms; Average system time: 13.779ms + +060/100 python3 ../../Python/code_unoptimised.py +Total real time: 2400759ms; Average real time: 40012.650ms +Total user time: 2397085ms; Average user time: 39951.416ms +Total system time: 829ms; Average system time: 13.816ms + +061/100 python3 ../../Python/code_unoptimised.py +Total real time: 2440893ms; Average real time: 40014.639ms +Total user time: 2437154ms; Average user time: 39953.344ms +Total system time: 842ms; Average system time: 13.803ms + +062/100 python3 ../../Python/code_unoptimised.py +Total real time: 2482389ms; Average real time: 40038.532ms +Total user time: 2478624ms; Average user time: 39977.806ms +Total system time: 854ms; Average system time: 13.774ms + +063/100 python3 ../../Python/code_unoptimised.py +Total real time: 2522115ms; Average real time: 40033.571ms +Total user time: 2518295ms; Average user time: 39972.936ms +Total system time: 878ms; Average system time: 13.936ms + +064/100 python3 ../../Python/code_unoptimised.py +Total real time: 2562794ms; Average real time: 40043.656ms +Total user time: 2558882ms; Average user time: 39982.531ms +Total system time: 894ms; Average system time: 13.968ms + +065/100 python3 ../../Python/code_unoptimised.py +Total real time: 2602534ms; Average real time: 40038.984ms +Total user time: 2598523ms; Average user time: 39977.276ms +Total system time: 914ms; Average system time: 14.061ms + +066/100 python3 ../../Python/code_unoptimised.py +Total real time: 2642097ms; Average real time: 40031.772ms +Total user time: 2638027ms; Average user time: 39970.106ms +Total system time: 930ms; Average system time: 14.090ms + +067/100 python3 ../../Python/code_unoptimised.py +Total real time: 2682809ms; Average real time: 40041.925ms +Total user time: 2678711ms; Average user time: 39980.761ms +Total system time: 946ms; Average system time: 14.119ms + +068/100 python3 ../../Python/code_unoptimised.py +Total real time: 2722832ms; Average real time: 40041.647ms +Total user time: 2718704ms; Average user time: 39980.941ms +Total system time: 962ms; Average system time: 14.147ms + +069/100 python3 ../../Python/code_unoptimised.py +Total real time: 2763409ms; Average real time: 40049.405ms +Total user time: 2759219ms; Average user time: 39988.681ms +Total system time: 974ms; Average system time: 14.115ms + +070/100 python3 ../../Python/code_unoptimised.py +Total real time: 2803622ms; Average real time: 40051.742ms +Total user time: 2799322ms; Average user time: 39990.314ms +Total system time: 994ms; Average system time: 14.200ms + +071/100 python3 ../../Python/code_unoptimised.py +Total real time: 2843997ms; Average real time: 40056.295ms +Total user time: 2839638ms; Average user time: 39994.901ms +Total system time: 1014ms; Average system time: 14.281ms + +072/100 python3 ../../Python/code_unoptimised.py +Total real time: 2884144ms; Average real time: 40057.555ms +Total user time: 2879715ms; Average user time: 39996.041ms +Total system time: 1026ms; Average system time: 14.250ms + +073/100 python3 ../../Python/code_unoptimised.py +Total real time: 2924188ms; Average real time: 40057.369ms +Total user time: 2919717ms; Average user time: 39996.123ms +Total system time: 1031ms; Average system time: 14.123ms + +074/100 python3 ../../Python/code_unoptimised.py +Total real time: 2965203ms; Average real time: 40070.310ms +Total user time: 2960668ms; Average user time: 40009.027ms +Total system time: 1035ms; Average system time: 13.986ms + +075/100 python3 ../../Python/code_unoptimised.py +Total real time: 3004512ms; Average real time: 40060.160ms +Total user time: 2999909ms; Average user time: 39998.786ms +Total system time: 1047ms; Average system time: 13.960ms + +076/100 python3 ../../Python/code_unoptimised.py +Total real time: 3045286ms; Average real time: 40069.552ms +Total user time: 3040618ms; Average user time: 40008.131ms +Total system time: 1059ms; Average system time: 13.934ms + +077/100 python3 ../../Python/code_unoptimised.py +Total real time: 3085100ms; Average real time: 40066.233ms +Total user time: 3080388ms; Average user time: 40005.038ms +Total system time: 1079ms; Average system time: 14.012ms + +078/100 python3 ../../Python/code_unoptimised.py +Total real time: 3124873ms; Average real time: 40062.474ms +Total user time: 3120075ms; Average user time: 40000.961ms +Total system time: 1100ms; Average system time: 14.102ms + +079/100 python3 ../../Python/code_unoptimised.py +Total real time: 3164580ms; Average real time: 40057.974ms +Total user time: 3159765ms; Average user time: 39997.025ms +Total system time: 1108ms; Average system time: 14.025ms + +080/100 python3 ../../Python/code_unoptimised.py +Total real time: 3205451ms; Average real time: 40068.137ms +Total user time: 3200541ms; Average user time: 40006.762ms +Total system time: 1124ms; Average system time: 14.050ms + +081/100 python3 ../../Python/code_unoptimised.py +Total real time: 3245427ms; Average real time: 40067.000ms +Total user time: 3240470ms; Average user time: 40005.802ms +Total system time: 1140ms; Average system time: 14.074ms + +082/100 python3 ../../Python/code_unoptimised.py +Total real time: 3285493ms; Average real time: 40066.987ms +Total user time: 3280436ms; Average user time: 40005.317ms +Total system time: 1161ms; Average system time: 14.158ms + +083/100 python3 ../../Python/code_unoptimised.py +Total real time: 3325568ms; Average real time: 40067.084ms +Total user time: 3320424ms; Average user time: 40005.108ms +Total system time: 1186ms; Average system time: 14.289ms + +084/100 python3 ../../Python/code_unoptimised.py +Total real time: 3365395ms; Average real time: 40064.226ms +Total user time: 3360206ms; Average user time: 40002.452ms +Total system time: 1202ms; Average system time: 14.309ms + +085/100 python3 ../../Python/code_unoptimised.py +Total real time: 3406115ms; Average real time: 40071.941ms +Total user time: 3400884ms; Average user time: 40010.400ms +Total system time: 1210ms; Average system time: 14.235ms + +086/100 python3 ../../Python/code_unoptimised.py +Total real time: 3445980ms; Average real time: 40069.534ms +Total user time: 3440737ms; Average user time: 40008.569ms +Total system time: 1214ms; Average system time: 14.116ms + +087/100 python3 ../../Python/code_unoptimised.py +Total real time: 3485848ms; Average real time: 40067.218ms +Total user time: 3480561ms; Average user time: 40006.448ms +Total system time: 1218ms; Average system time: 14.000ms + +088/100 python3 ../../Python/code_unoptimised.py +Total real time: 3526019ms; Average real time: 40068.397ms +Total user time: 3520711ms; Average user time: 40008.079ms +Total system time: 1222ms; Average system time: 13.886ms + +089/100 python3 ../../Python/code_unoptimised.py +Total real time: 3566874ms; Average real time: 40077.235ms +Total user time: 3561449ms; Average user time: 40016.280ms +Total system time: 1251ms; Average system time: 14.056ms + +090/100 python3 ../../Python/code_unoptimised.py +Total real time: 3606756ms; Average real time: 40075.066ms +Total user time: 3601286ms; Average user time: 40014.288ms +Total system time: 1275ms; Average system time: 14.166ms + +091/100 python3 ../../Python/code_unoptimised.py +Total real time: 3648037ms; Average real time: 40088.318ms +Total user time: 3642553ms; Average user time: 40028.054ms +Total system time: 1279ms; Average system time: 14.054ms + +092/100 python3 ../../Python/code_unoptimised.py +Total real time: 3687962ms; Average real time: 40086.543ms +Total user time: 3682406ms; Average user time: 40026.152ms +Total system time: 1287ms; Average system time: 13.989ms + +093/100 python3 ../../Python/code_unoptimised.py +Total real time: 3728358ms; Average real time: 40089.870ms +Total user time: 3722721ms; Average user time: 40029.258ms +Total system time: 1300ms; Average system time: 13.978ms + +094/100 python3 ../../Python/code_unoptimised.py +Total real time: 3769030ms; Average real time: 40096.063ms +Total user time: 3763304ms; Average user time: 40035.148ms +Total system time: 1324ms; Average system time: 14.085ms + +095/100 python3 ../../Python/code_unoptimised.py +Total real time: 3808456ms; Average real time: 40089.010ms +Total user time: 3802639ms; Average user time: 40027.778ms +Total system time: 1348ms; Average system time: 14.189ms + +096/100 python3 ../../Python/code_unoptimised.py +Total real time: 3849310ms; Average real time: 40096.979ms +Total user time: 3843465ms; Average user time: 40036.093ms +Total system time: 1352ms; Average system time: 14.083ms + +097/100 python3 ../../Python/code_unoptimised.py +Total real time: 3889630ms; Average real time: 40099.278ms +Total user time: 3883706ms; Average user time: 40038.206ms +Total system time: 1372ms; Average system time: 14.144ms + +098/100 python3 ../../Python/code_unoptimised.py +Total real time: 3929901ms; Average real time: 40101.030ms +Total user time: 3923938ms; Average user time: 40040.183ms +Total system time: 1376ms; Average system time: 14.040ms + +099/100 python3 ../../Python/code_unoptimised.py +Total real time: 3970096ms; Average real time: 40101.979ms +Total user time: 3964116ms; Average user time: 40041.575ms +Total system time: 1385ms; Average system time: 13.989ms + +100/100 python3 ../../Python/code_unoptimised.py +Total real time: 4010256ms; Average real time: 40102.560ms +Total user time: 4004178ms; Average user time: 40041.780ms +Total system time: 1413ms; Average system time: 14.130ms + + +Total real time: 4010256ms; Average real time: 40102.560ms +Total user time: 4004178ms; Average user time: 40041.780ms +Total system time: 1413ms; Average system time: 14.130ms diff --git a/www/scripts/rhinemann-results.txt b/www/scripts/rhinemann-results.txt new file mode 100644 index 0000000..2b63242 --- /dev/null +++ b/www/scripts/rhinemann-results.txt @@ -0,0 +1,117 @@ +--- C --- +Unoptimised: + +real 0m0.345s +user 0m0.343s +sys 0m0.000s + +Cycle: + +real 0m0.004s +user 0m0.004s +sys 0m0.000s + +--- Go --- +Unoptimised: + +real 0m1.011s +user 0m0.988s +sys 0m0.121s + +Cycle: + +real 0m0.173s +user 0m0.159s +sys 0m0.070s + +--- Java --- +Unoptimised: + +real 0m0.168s +user 0m0.160s +sys 0m0.021s + +Cycle: + +real 0m0.083s +user 0m0.082s +sys 0m0.013s + +--- JavaScript --- +Unoptimised: + +real 0m0.855s +user 0m0.839s +sys 0m0.028s + +Cycle: + +real 0m0.105s +user 0m0.095s +sys 0m0.012s + +--- Kotlin --- +Unoptimised: + +real 0m0.162s +user 0m0.169s +sys 0m0.029s + +Cycle: + +real 0m0.074s +user 0m0.079s +sys 0m0.022s + +--- Python --- +Unoptimised: + +real 0m40.609s +user 0m40.468s +sys 0m0.024s + +Cycle: + +real 0m2.463s +user 0m2.448s +sys 0m0.008s + +--- Rust --- +Unoptimised: + +real 0m0.242s +user 0m0.238s +sys 0m0.004s + +Cycle: + +real 0m0.003s +user 0m0.000s +sys 0m0.003s + +--- TypeScript --- +Unoptimised: + +real 0m0.086s +user 0m0.068s +sys 0m0.016s + +Cycle: + +real 0m0.108s +user 0m0.089s +sys 0m0.021s + +--- Zig --- +Unoptimised: + +real 0m0.060s +user 0m0.060s +sys 0m0.000s + +Cycle: + +real 0m0.003s +user 0m0.003s +sys 0m0.000s + diff --git a/www/scripts/time-aggregation-live.sh b/www/scripts/time-aggregation-live.sh new file mode 100644 index 0000000..4a9e1bc --- /dev/null +++ b/www/scripts/time-aggregation-live.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +benchmark_live() { + total_real_time=0 + total_user_time=0 + total_system_time=0 + + for ((i=0; i<$1; i++)); do + printf "%0${#1}d/%0${#1}d %s\n" $((i + 1)) $1 "$2" >&2 + time_slept=($( (TIMEFORMAT="%R %U %S"; time $2 1>/dev/null) |& tr -d . )) + + ((total_real_time+=$(printf '%d' $(echo ${time_slept[0]} | sed 's/^0*//')))) + ((total_user_time+=$(printf '%d' $(echo ${time_slept[1]} | sed 's/^0*//')))) + ((total_system_time+=$(printf '%d' $(echo ${time_slept[2]} | sed 's/^0*//')))) + + echo "Total real time: ${total_real_time}ms; Average real time: $(bc <<< "scale=3; $total_real_time / $((i + 1))")ms" + echo "Total user time: ${total_user_time}ms; Average user time: $(bc <<< "scale=3; $total_user_time / $((i + 1))")ms" + echo "Total system time: ${total_system_time}ms; Average system time: $(bc <<< "scale=3; $total_system_time / $((i + 1))")ms" + + printf "\n" + done + + printf "\n" + + echo "Total real time: ${total_real_time}ms; Average real time: $(bc <<< "scale=3; $total_real_time / $1")ms" + echo "Total user time: ${total_user_time}ms; Average user time: $(bc <<< "scale=3; $total_user_time / $1")ms" + echo "Total system time: ${total_system_time}ms; Average system time: $(bc <<< "scale=3; $total_system_time / $1")ms" +} + +"$@" + +# benchmark 3 'sleep 1s' +# benchmark 3 'python3 ../../Python/code_cycle.py' +# benchmark 10 '../../Rust/code_cycle/target/release/code_cycle' diff --git a/www/scripts/time-aggregation-progress.sh b/www/scripts/time-aggregation-progress.sh new file mode 100644 index 0000000..89c6ed6 --- /dev/null +++ b/www/scripts/time-aggregation-progress.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +benchmark() { + total_real_time=0 + total_user_time=0 + total_system_time=0 + for ((i=0; i<$1; i++)); do + printf "\r%04d/%04d %s" $i $1 "$2" >&2 + time_slept=($( (TIMEFORMAT="%R %U %S"; time $2 1>/dev/null) |& tr -d . )) + + #echo -e "${time_slept[@]}\n" + + #((total_real_time+=$(echo ${time_slept[0]} | sed 's/^0*(?=[0-9])//;s/^0/0/'))) + ((total_real_time+=$(printf '%d' $(echo ${time_slept[0]} | sed 's/^0*//')))) + #((total_user_time+=$(echo ${time_slept[1]} | sed 's/^0*(?=[0-9])//;s/^0/0/'))) + ((total_user_time+=$(printf '%d' $(echo ${time_slept[1]} | sed 's/^0*//')))) + #((total_system_time+=$(echo ${time_slept[2]} | sed 's/^0*(?=[0-9])//;s/^0/0/'))) + ((total_system_time+=$(printf '%d' $(echo ${time_slept[2]} | sed 's/^0*//')))) + done + + printf "\n" >&2 + + echo "Total real time: ${total_real_time}ms; Average real time: $(bc <<< "scale=3; $total_real_time / $1")ms" + echo "Total user time: ${total_user_time}ms; Average user time: $(bc <<< "scale=3; $total_user_time / $1")ms" + echo "Total system time: ${total_system_time}ms; Average system time: $(bc <<< "scale=3; $total_system_time / $1")ms" +} + +# benchmark 3 'sleep 1s' +#benchmark 3 'python3 ../../Python/code_cycle.py' diff --git a/www/scripts/time-aggregation.sh b/www/scripts/time-aggregation.sh new file mode 100644 index 0000000..3c530a3 --- /dev/null +++ b/www/scripts/time-aggregation.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +benchmark() { + total_real_time=0 + total_user_time=0 + total_system_time=0 + + for ((i=0; i<$1; i++)); do + printf "\r%0${#1}d/%0${#1}d %s" $((i + 1)) $1 "$2" >&2 + time_slept=($( (TIMEFORMAT="%R %U %S"; time $2 1>/dev/null) |& tr -d . )) + + ((total_real_time+=$(printf '%d' $(echo ${time_slept[0]} | sed 's/^0*//')))) + ((total_user_time+=$(printf '%d' $(echo ${time_slept[1]} | sed 's/^0*//')))) + ((total_system_time+=$(printf '%d' $(echo ${time_slept[2]} | sed 's/^0*//')))) + done + + printf "\n" >&2 + + echo "Total real time: ${total_real_time}ms; Average real time: $(bc <<< "scale=3; $total_real_time / $1")ms" + echo "Total user time: ${total_user_time}ms; Average user time: $(bc <<< "scale=3; $total_user_time / $1")ms" + echo "Total system time: ${total_system_time}ms; Average system time: $(bc <<< "scale=3; $total_system_time / $1")ms" +} + +"$@" + +# benchmark 3 'sleep 1s' +# benchmark 3 'python3 ../../Python/code_cycle.py' +# benchmark 10 '../../Rust/code_cycle/target/release/code_cycle' \ No newline at end of file