-
Notifications
You must be signed in to change notification settings - Fork 98
/
run.sh
executable file
·1055 lines (818 loc) · 27.4 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
# Read the first arg passed to the script
first_arg=$1
outfile=$2
# only truncate file when this is empty, otherwise append
appendToFile=$3
if [ -z "$appendToFile" ]; then
runs=10
slow_lang_runs=10
else
runs=3
slow_lang_runs=2
fi
if [[ -n $outfile ]]; then
if [ -f "$outfile" ] && [ -z "$appendToFile" ]; then
truncate -s 0 "$outfile"
fi
# this will be used in langauge directories
# so we need to go up one level
outfile="../$outfile"
fi
time="$(which gtime 2>/dev/null || which time 2>/dev/null)"
if [[ -z "${time}" ]]; then
echo 'time or gtime must be available in $PATH'
exit 1
fi
run_command() {
local title="$1"
local num_times="$2"
local cmd="$3"
if [ -z "$title" ] || [ -z "$cmd" ] || [ -z "$num_times" ]; then
echo "Error: Invalid input. Usage: run_command <num_of_times> <command>"
return 1
fi
# remove the first three args
shift 3
# use awk to indent the output so it shows up as a codeblock in markdown
if [ -z "$outfile" ]; then
# outfile is empty, so write to stdout
echo -e "$title:\n"
for ((i = 1; i <= num_times; i++)); do
($time -f 'total: %es memory: %Mk' $cmd "$@" 2>&1) | awk '{print "\t" $0}'
done
else
# write to a file and stdout
echo -e "\n$title:\n" | tee -a "$outfile"
for ((i = 1; i <= num_times; i++)); do
($time -f 'total: %es memory: %Mk' $cmd "$@" 2>&1) | awk '{print "\t" $0}' | tee -a "$outfile"
done
fi
}
run_go() {
echo "Running Go" &&
cd ./go &&
go build &&
run_command "Go" $runs ./related &&
check_output "related_posts_go.json"
}
run_go_concurrent() {
echo "Running Go Concurrent" &&
cd ./go_con &&
go build &&
run_command "Go Concurrent" $runs ./related_concurrent &&
check_output "related_posts_go_con.json"
}
run_cpp() {
echo "Running C++" &&
cd ./cpp &&
if [ -z "$appendToFile" ]; then # only build on 5k run
clang++ -O3 -std=c++20 -I./include main.cpp -o main
fi &&
run_command "C++" $runs ./main &&
check_output "related_posts_cpp.json"
}
run_cpp_con() {
echo "Running C++ Concurrent" &&
cd ./cpp &&
if [ -z "$appendToFile" ]; then # only build on 5k run
clang++ -std=c++20 -pthread -I./include -O3 main_con.cpp -o main_con
fi &&
run_command "C++ Concurrent" $runs ./main_con &&
check_output "related_posts_cpp_con.json"
}
run_rust() {
echo "Running Rust" &&
cd ./rust &&
cargo build --release &&
run_command "Rust" $runs ./target/release/rust &&
check_output "related_posts_rust.json"
}
run_rust_con() {
echo "Running Rust Rayon" &&
cd ./rust_con &&
cargo build --release &&
run_command "Rust Concurrent" $runs ./target/release/rust_rayon &&
check_output "related_posts_rust_con.json"
}
run_python() {
echo "Running Python" &&
cd ./python &&
if [ ! -d "venv" ]; then
python3 -m venv venv
fi &&
source venv/bin/activate &&
run_command "Python" $slow_lang_runs python3 ./related.py &&
deactivate &&
check_output "related_posts_python.json"
}
run_pypy() {
echo "Running PyPy" &&
cd ./python &&
if [ ! -d "venv" ]; then
python3 -m venv venv
fi &&
source venv/bin/activate &&
run_command "Pypy" $runs pypy3 ./related.py &&
deactivate &&
check_output "related_posts_python.json"
}
run_python_np() {
echo "Running Numpy" &&
cd ./python &&
if [ ! -d "venv" ]; then
python3 -m venv venv
fi &&
source venv/bin/activate &&
(pip freeze | grep scipy) || pip install -r requirements.txt &&
run_command "Numpy" $slow_lang_runs python3 ./related_np.py &&
deactivate &&
check_output "related_posts_python_np.json"
}
run_python_numba() {
echo "Running Numba" &&
cd ./python &&
if [ ! -d "venv" ]; then
python3 -m venv venv
fi &&
source venv/bin/activate &&
(pip freeze | grep numba) || pip install -r requirements.txt &&
run_command "Numba" $slow_lang_runs python3 ./related_numba.py &&
deactivate &&
check_output "related_posts_python_numba.json"
}
run_python_numba_con() {
echo "Running Numba Concurrent" &&
cd ./python &&
if [ ! -d "venv" ]; then
python3 -m venv venv
fi &&
source venv/bin/activate &&
(pip freeze | grep numba) || pip install -r requirements.txt &&
run_command "Numba Concurrent" $slow_lang_runs python3 ./related_numba_con.py &&
deactivate &&
check_output "related_posts_python_numba_con.json"
}
run_crystal() {
echo "Running Crystal" &&
cd ./crystal &&
crystal build --release src/crystal.cr &&
run_command "Crystal" $runs ./crystal &&
check_output "related_posts_cr.json"
}
run_zig() {
echo "Running Zig" &&
cd ./zig &&
if [ -z "$appendToFile" ]; then # only build on 5k run
zig build-exe -lc -O ReleaseSafe main.zig
fi &&
run_command "Zig" $runs ./main &&
check_output "related_posts_zig.json"
}
run_zig_con() {
echo "Running Zig" &&
cd ./zig_con &&
if [ -z "$appendToFile" ]; then # only build on 5k run
zig build-exe -O ReleaseSafe main.zig
fi &&
run_command "Zig Concurrent" $runs ./main &&
check_output "related_posts_zig_con.json"
}
run_julia() {
echo "Running Julia" &&
cd ./julia &&
julia -e 'using Pkg; Pkg.activate("Related"); Pkg.instantiate()' &&
run_command "Julia" $runs julia --startup-file=no --project=Related -e "using Related; main()" &&
check_output "related_posts_julia.json"
}
run_julia_highly_optimized() {
echo "Running Julia Highly Optimized" &&
cd ./julia_highly_optimized &&
julia -e 'using Pkg; Pkg.activate("RelatedHO"); Pkg.instantiate()' &&
run_command "Julia HO" $runs julia --startup-file=no --project=RelatedHO -e "using RelatedHO; main()" &&
check_output "related_posts_julia_highly_optimized.json"
}
run_julia_con() {
echo "Running Julia Concurrent" &&
cd ./julia_con &&
julia -e 'using Pkg; Pkg.activate("RelatedCon"); Pkg.instantiate()' &&
run_command "Julia Concurrent" $runs julia --threads=auto --startup-file=no --project=RelatedCon -e "using RelatedCon; main()" &&
check_output "related_posts_julia_con.json"
}
run_odin() {
echo "Running Odin" &&
cd ./odin &&
odin build related.odin -file -o:speed &&
run_command "Odin" $runs ./related &&
check_output "related_posts_odin.json"
}
run_vlang() {
echo "Running Vlang" &&
cd ./v &&
v -prod -skip-unused related.v &&
run_command "Vlang" $runs ./related &&
check_output "related_posts_v.json"
}
run_jq() {
# run once as it's very slow. ~50s
echo "Running jq" &&
cd ./jq &&
run_command "JQ" $slow_lang_runs jq -c -f ./related.jq ../posts.json >../related_posts_jq.json &&
check_output "related_posts_jq.json"
}
run_dart() {
echo "Running Dart VM" &&
cd ./dart &&
run_command "Dart VM" $runs dart related.dart &&
check_output "related_posts_dart.json"
}
run_dart_aot() {
echo "Running Dart AOT" &&
cd ./dart &&
if [ -z "$appendToFile" ]; then # only build on 5k run
dart compile exe related.dart -o related
fi &&
run_command "Dart AOT" $runs ./related &&
check_output "related_posts_dart.json"
}
run_swift() {
echo "Running Swift" &&
cd ./swift &&
swift build -c release &&
run_command "Swift" $runs ./.build/release/related &&
check_output "related_posts_swift.json"
}
run_swift_con() {
echo "Running Swift Concurrent" &&
cd ./swift_con &&
swift build -c release &&
run_command "Swift Concurrent" $runs ./.build/release/related &&
check_output "related_posts_swift_con.json"
}
run_arturo() {
echo "Running Arturo" &&
cd ./arturo &&
run_command "Arturo" $runs arturo related.art &&
check_output "related_posts_arturo.json"
}
run_js() {
echo "Running $1" &&
cd ./js &&
title=$(echo "$1" | sed 's/\b\(.\)/\u\1/g') &&
if [ "$1" = "deno" ]; then
run_command "JS ($title)" $runs deno run --allow-read --allow-write deno.js
else
run_command "JS ($title)" $runs $1 $1.js
fi &&
check_output "related_posts_$1.json"
}
run_java() {
VM_OPTIONS="-XX:+UseSerialGC"
echo "Running Java (JIT)" &&
cd ./java &&
java -version &&
mvn -q -B -Pjvm clean package &&
run_command "Java (JIT)" $runs java $VM_OPTIONS -jar ./target/main.jar &&
check_output "related_posts_java.json"
}
# weirdly slower, need to investigate
run_java_con() {
VM_OPTIONS="-XX:+UseSerialGC"
echo "Running Java (JIT)" &&
cd ./java &&
java -version &&
mvn -q -B -Pjvm_con clean package &&
run_command "Java Concurrent (JIT)" $runs java $VM_OPTIONS -jar ./target/main.jar &&
check_output "related_posts_java_con.json"
}
run_java_graal() {
export JAVA_HOME="$GRAALVM_HOME"
echo "Running Java (GraalVM)" &&
cd ./java &&
java -version &&
mvn -q -B clean package &&
mvn -q -B -Pnative,pgo package &&
run_command "Java (GraalVM)" $runs ./target/related &&
check_output "related_posts_java.json"
}
run_java_graal_con() {
echo "Running Java (GraalVM) Concurrent" &&
cd ./java &&
java -version &&
mvn -q -B -Pnative,pgo,parallel clean package &&
run_command "Java (GraalVM) Concurrent" $runs ./target/related &&
check_output "related_posts_java_con.json"
}
run_nim() {
echo "Running Nim" &&
cd ./nim &&
if [ -z "$appendToFile" ]; then # only build on 5k run
nimble -y install -d &&
nimble --verbose build -d:release --cc:clang
fi &&
run_command "Nim" $runs ./related &&
check_output "related_posts_nim.json"
}
run_nim_con() {
echo "Running Nim Concurrent" &&
cd ./nim_con &&
if [ -z "$appendToFile" ]; then # only build on 5k run
nimble -y install -d &&
./build.sh clang
fi &&
run_command "Nim Concurrent" $runs ./build/related_con &&
check_output "related_posts_nim_con.json"
}
run_fsharp() {
echo "Running FSharp (JIT)" &&
cd ./fsharp/jit &&
if [ -z "$appendToFile" ]; then # only build on 5k run
dotnet restore &&
dotnet publish -c release
fi &&
run_command "F# (JIT)" $runs ./bin/release/net8.0/fsharp_jit &&
cd .. &&
check_output "related_posts_fsharp_jit.json"
}
run_fsharp_aot() {
echo "Running FSharp (AOT)" &&
cd ./fsharp/aot &&
if [ -z "$appendToFile" ]; then # only build on 5k run
dotnet restore &&
dotnet publish -c release --self-contained -p PublishAot=true -o "bin/release/net8.0/aot"
fi &&
run_command "F# (AOT)" $runs ./bin/release/net8.0/aot/fsharp_aot &&
cd .. &&
check_output "related_posts_fsharp_aot.json"
}
run_fsharp_con() {
echo "Running FSharp Concurrent" &&
cd ./fsharp_con &&
if [ -z "$appendToFile" ]; then # only build on 5k run
dotnet restore &&
dotnet publish -c release
fi &&
run_command "F# Concurrent" $runs ./bin/release/net8.0/fsharp_con &&
check_output "related_posts_fsharp_con.json"
}
run_fsharp_con_aot() {
echo "Running FSharp Concurrent (AOT)" &&
cd ./fsharp_con &&
if [ -z "$appendToFile" ]; then # subsequent runs
dotnet restore &&
dotnet publish -c release --self-contained -p PublishAot=true -o "bin/release/net8.0/aot"
fi &&
run_command "F# Concurrent (AOT)" $runs ./bin/release/net8.0/aot/fsharp_con &&
check_output "related_posts_fsharp_con.json"
}
run_csharp() {
echo "Running CSharp (JIT)" &&
cd ./csharp &&
if [ -z "$appendToFile" ]; then # subsequent runs
dotnet publish -c release --self-contained -o "bin/release/net8.0/jit"
fi &&
run_command "C# (JIT)" $runs ./bin/release/net8.0/jit/related &&
check_output "related_posts_csharp.json"
}
run_csharp_aot() {
echo "Running CSharp (AOT)" &&
cd ./csharp &&
if [ -z "$appendToFile" ]; then # subsequent runs
dotnet publish -c release --self-contained -p PublishAot=true -o "bin/release/net8.0/aot"
fi &&
run_command "C# (AOT)" $runs ./bin/release/net8.0/aot/related &&
check_output "related_posts_csharp.json"
}
run_csharp_con() {
echo "Running CSharp Concurrent (JIT)" &&
cd ./csharp_con &&
if [ -z "$appendToFile" ]; then # subsequent runs
dotnet publish -c release --self-contained -o "bin/release/net8.0/jit"
fi &&
run_command "C# Concurrent (JIT)" $runs ./bin/release/net8.0/jit/related &&
check_output "related_posts_csharp_con.json"
}
run_csharp_con_aot() {
echo "Running CSharp Concurrent (AOT)" &&
cd ./csharp_con &&
if [ -z "$appendToFile" ]; then # subsequent runs
dotnet publish -c release --self-contained -p PublishAot=true -o "bin/release/net8.0/aot"
fi &&
run_command "C# Concurrent (AOT)" 1 ./bin/release/net8.0/aot/related &&
check_output "related_posts_csharp_con.json"
}
run_luajit() {
echo "Running LuaJIT" &&
cd ./lua &&
if [ -z "$appendToFile" ]; then # subsequent runs
sudo luarocks --lua-version 5.1 install luasocket
fi &&
run_command "LuaJIT" $runs luajit only_lua.lua &&
check_output "related_posts_lua.json"
}
run_luajit_jit_off() {
echo "Running LuaJIT (JIT OFF)" &&
cd ./lua &&
if [ -z "$appendToFile" ]; then # subsequent runs
sudo luarocks --lua-version 5.1 install luasocket
fi &&
run_command "LuaJIT (JIT OFF)" $slow_lang_runs luajit -joff only_lua.lua &&
check_output "related_posts_lua.json"
}
run_lua() {
echo "Running Lua" &&
sudo luarocks install luasocket &&
cd ./lua &&
run_command "Lua" $slow_lang_runs lua only_lua.lua &&
check_output "related_posts_lua.json"
}
run_ocaml() {
echo "Running Ocaml" &&
cd ./ocaml &&
if [ -z "$appendToFile" ]; then # only build on 5k run
opam install . --deps-only -y &&
opam exec -- dune build
fi &&
run_command "Ocaml" $runs ./_build/default/bin/main.exe &&
check_output "related_posts_ocaml.json"
}
run_haskell() {
echo "Running Haskell" &&
cd ./haskell &&
cabal build &&
run_command "Haskell" $runs "$(cabal list-bin related-post-gen)" &&
check_output "related_posts_haskell.json"
}
run_d() {
echo "Running D" &&
cd ./d &&
dub build --build=release &&
run_command "D" $runs ./related &&
check_output "related_posts_d.json"
}
run_d_v2() {
echo "Running D v2" &&
cd ./d_v2 &&
dub build --build=release &&
run_command "D (v2)" $runs ./related &&
check_output "related_posts_d2.json"
}
run_d_con() {
echo "Running D Concurrent" &&
cd ./d_con &&
dub build --build=release &&
run_command "D Concurrent" $runs ./related_concurrent &&
check_output "related_posts_d_con.json"
}
run_d_con_v2() {
echo "Running D Concurrent (v2)" &&
cd ./d_con_v2 &&
dub build --build=release &&
run_command "D Concurrent (v2)" $runs ./related_concurrent &&
check_output "related_posts_d_con_v2.json"
}
run_erlang() {
echo "Running Erlang" &&
cd ./erlang &&
rebar3 escriptize &&
run_command "Erlang" $slow_lang_runs ./_build/default/bin/related_erl &&
check_output "related_posts_erlang.json"
}
run_common_lisp_sbcl() {
echo "Running Common Lisp (SBCL)" &&
cd ./common-lisp &&
sbcl --control-stack-size 10 --non-interactive --load related.lisp
run_command "Common Lisp (SBCL)" $slow_lang_runs ./related &&
check_output "related-cl.json"
}
run_clojure() {
echo "Running Clojure" &&
cd ./clojure &&
lein uberjar &&
run_command "Clojure" $runs java -jar ./target/related.jar &&
check_output "related_posts_clj.json"
}
run_ruby() {
echo "Running ruby" &&
cd ./ruby &&
run_command "Ruby" $slow_lang_runs ruby related.rb &&
check_output "related_posts_ruby.json"
}
run_dascript() {
echo "Running daScript (interpreted)" &&
cd ./dascript &&
run_command "daScript (interpreted)" $slow_lang_runs das related.das &&
check_output "related_posts_dascript.json"
}
run_racket() {
echo "Running Racket" &&
cd ./racket &&
if [ -z "$appendToFile" ]; then # only build on 5k run
raco pkg install --auto --name related --no-docs --skip-installed &&
raco make related.rkt
fi &&
run_command "Racket" $runs racket related.rkt &&
check_output "related_posts_racket.json"
}
run_typed_racket() {
echo "Running Typed Racket" &&
cd ./racket &&
if [ -z "$appendToFile" ]; then # only build on 5k run
raco pkg install --auto --name related --no-docs --skip-installed &&
raco make typed/related.rkt
fi &&
run_command "Typed Racket" $runs racket typed/related.rkt &&
check_output "related_posts_typed_racket.json"
}
run_lobster_jit() {
echo "Running Lobster (JIT)" &&
cd ./lobster &&
run_command "Lobster (JIT)" $slow_lang_runs lobster related.lobster &&
check_output "related_posts_lobster.json"
}
run_lobster_cpp() {
lobster_bin=$(which lobster)
if [ -z "$lobster_bin" ]; then
echo "Error: Lobster binary not found in PATH."
exit 1
fi
lobster_git_dir=$(dirname "$(dirname "$lobster_bin")")
current_directory=$(pwd)
echo "Running Lobster (C++ Backend)" &&
cp lobster "$lobster_git_dir/lobster" -r --force &&
cd "$lobster_git_dir" &&
lobster --cpp lobster/related.lobster &&
cd dev &&
cmake -DCMAKE_BUILD_TYPE=Release -DLOBSTER_ENGINE=OFF -DLOBSTER_TOCPP=ON && make -j8 &&
cd "$current_directory" &&
cd ./lobster &&
run_command "Lobster (C++)" $runs compiled_lobster &&
check_output "related_posts_lobster.json"
}
run_scala_native() {
echo "Running Scala Native" &&
cd ./scala_native &&
if [ -z "$appendToFile" ]; then # only build on 5k run
sbt nativeLink
fi &&
scala_version=$(ls -d target/*/ | grep -o 'scala-[^/]*' | head -1) &&
run_command "Scala Native" $runs ./target/$scala_version/scala_native-out &&
check_output "related_posts_scala.json"
}
run_r() {
echo "Running R" &&
cd ./r &&
run_command "R" $slow_lang_runs Rscript ./related.R &&
check_output "related_posts_r.json"
}
run_inko() {
echo "Running Inko" &&
cd ./inko &&
if [ -z "$appendToFile" ]; then # only build on 5k run
inko build --opt aggressive
fi &&
run_command "Inko" $slow_lang_runs ./build/aggressive/main &&
check_output "related_posts_inko.json"
}
run_neat() {
echo "Running Neat" &&
cd ./neat &&
neat -optimize related.nt &&
run_command "Neat" $runs ./related &&
check_output "related_posts_neat.json"
}
check_output() {
cd ..
# only check output if we're not appending to a file. ie: 1st round
if [ -z "$appendToFile" ]; then
echo "Checking output" &&
python3 verify.py "$1"
fi
}
if [ "$first_arg" = "go" ]; then
run_go
elif [ "$first_arg" = "go_con" ]; then
run_go_concurrent
elif [ "$first_arg" = "cpp" ]; then
run_cpp
elif [ "$first_arg" = "cpp_con" ]; then
run_cpp_con
elif [ "$first_arg" = "rust" ]; then
run_rust
elif [ "$first_arg" = "rust_con" ]; then
run_rust_con
elif [ "$first_arg" = "py" ]; then
run_python
elif [ "$first_arg" = "pypy" ]; then
run_pypy
elif [ "$first_arg" = "numpy" ]; then
run_python_np
elif [ "$first_arg" = "numba" ]; then
run_python_numba
elif [ "$first_arg" = "numba_con" ]; then
run_python_numba_con
elif [ "$first_arg" = "cr" ]; then
run_crystal
elif [ "$first_arg" = "zig" ]; then
run_zig
elif [ "$first_arg" = "zig_con" ]; then
run_zig_con
elif [ "$first_arg" = "julia" ]; then
run_julia
elif [ "$first_arg" = "julia_highly_optimized" ]; then
run_julia_highly_optimized
elif [ "$first_arg" = "julia_con" ]; then
run_julia_con
elif [ "$first_arg" = "odin" ]; then
run_odin
elif [ "$first_arg" = "jq" ]; then
run_jq
elif [ "$first_arg" = "v" ]; then
run_vlang
elif [ "$first_arg" = "dart" ]; then
run_dart
elif [ "$first_arg" = "dart_aot" ]; then
run_dart_aot
elif [ "$first_arg" = "swift" ]; then
run_swift
elif [ "$first_arg" = "art" ]; then
run_arturo
elif [ "$first_arg" = "swift_con" ]; then
run_swift_con
elif [ "$first_arg" = "node" ]; then
run_js "node"
elif [ "$first_arg" = "bun" ]; then
run_js "bun"
elif [ "$first_arg" = "deno" ]; then
run_js "deno"
elif [ "$first_arg" = "java" ]; then
run_java
elif [ "$first_arg" = "java_con" ]; then
run_java_con
elif [ "$first_arg" = "java_graal" ]; then
run_java_graal
elif [ "$first_arg" = "java_graal_con" ]; then
run_java_graal_con
elif [ "$first_arg" = "nim" ]; then
run_nim
elif [ "$first_arg" = "nim_con" ]; then
run_nim_con
elif [ "$first_arg" = "fsharp" ]; then
run_fsharp
elif [ "$first_arg" = "fsharp_aot" ]; then
run_fsharp_aot
elif [ "$first_arg" = "csharp" ]; then
run_csharp
elif [ "$first_arg" = "csharp_aot" ]; then
run_csharp_aot
elif [ "$first_arg" = "csharp_con" ]; then
run_csharp_con
elif [ "$first_arg" = "csharp_con_aot" ]; then
run_csharp_con_aot
elif [ "$first_arg" = "fsharp_con" ]; then
run_fsharp_con
elif [ "$first_arg" = "fsharp_con_aot" ]; then
run_fsharp_con_aot
elif [ "$first_arg" = "luajit" ]; then
run_luajit
elif [ "$first_arg" = "luajit_off" ]; then
run_luajit_jit_off
elif [ "$first_arg" = "lua" ]; then
run_lua
elif [ "$first_arg" = "ocaml" ]; then
run_ocaml
elif [ "$first_arg" = "haskell" ]; then
run_haskell
elif [ "$first_arg" = "d" ]; then
run_d
elif [ "$first_arg" = "d2" ]; then
run_d_v2
elif [ "$first_arg" = "d_con" ]; then
run_d_con
elif [ "$first_arg" = "d_con_v2" ]; then
run_d_con_v2
elif [ "$first_arg" = "erlang" ]; then
run_erlang
elif [ "$first_arg" = "cl" ]; then
run_common_lisp_sbcl
elif [ "$first_arg" = "clj" ]; then
run_clojure
elif [ "$first_arg" = "ruby" ]; then
run_ruby
elif [ "$first_arg" = "dascript" ]; then
run_dascript
elif [ "$first_arg" = "racket" ]; then
run_racket
elif [ "$first_arg" = "typed_racket" ]; then
run_typed_racket
elif [ "$first_arg" = "lobster" ]; then
run_lobster_jit
elif [ "$first_arg" = "lobster_cpp" ]; then
run_lobster_cpp
elif [ "$first_arg" = "scala_native" ]; then
run_scala_native
elif [ "$first_arg" = "r" ]; then
run_r
elif [ "$first_arg" = "inko" ]; then
run_inko
elif [ "$first_arg" = "neat" ]; then
run_neat
elif [ "$first_arg" = "all" ]; then
echo -e "Running all\n" &&
run_go || echo -e "\n" &&
run_go_concurrent || echo -e "\n" &&
run_rust || echo -e "\n" &&
run_rust_con || echo -e "\n" &&
run_d || echo -e "\n" &&
run_d_v2 || echo -e "\n" &&
run_d_con || echo -e "\n" &&
run_cpp || echo -e "\n" &&
run_cpp_con || echo -e "\n" &&
run_python || echo -e "\n" &&
run_pypy || echo -e "\n" &&
run_python_np || echo -e "\n" &&
numba_con || echo -e "\n" &&
# run_python_numba || echo -e "\n" && break rules but very interesting
run_crystal || echo -e "\n" &&
run_zig || echo -e "\n" &&
run_zig_con || echo -e "\n" &&
run_julia || echo -e "\n" &&
run_julia_highly_optimized || echo -e "\n" &&
run_julia_con || echo -e "\n" &&
run_odin || echo -e "\n" &&
run_vlang || echo -e "\n" &&
run_dart || echo -e "\n" &&
run_dart_aot || echo -e "\n" &&
run_swift || echo -e "\n" &&
run_swift_con || echo -e "\n" &&
run_js "node" || echo -e "\n" &&
run_js "bun" || echo -e "\n" &&
run_js "deno" || echo -e "\n" &&
run_java || echo -e "\n" &&
run_java_con || echo -e "\n" &&
run_java_graal || echo -e "\n" &&
run_java_graal_con || echo -e "\n" &&
run_nim || echo -e "\n" &&
run_nim_con || echo -e "\n" &&
run_fsharp || echo -e "\n" &&
run_fsharp_aot || echo -e "\n" &&
run_fsharp_con || echo -e "\n" &&
run_fsharp_con_aot || echo -e "\n" &&
run_csharp || echo -e "\n" &&
run_csharp_aot || echo -e "\n" &&
run_csharp_con || echo -e "\n" &&
run_csharp_con_aot || echo -e "\n" &&
run_luajit || echo -e "\n" &&
run_luajit_jit_off || echo -e "\n" &&
run_lua || echo -e "\n" &&
run_ocaml || echo -e "\n" &&