-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
3,334 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Hello World | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
hello-world: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- run: echo LOCAL ${{ env.LOCAL }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup LLVM | ||
uses: ZhongRuoyu/setup-llvm@v0 | ||
with: | ||
llvm-version: 17 | ||
|
||
- name: Setup GraalVM w/ native-image | ||
uses: graalvm/setup-graalvm@v1 | ||
with: | ||
java-version: '23' | ||
distribution: 'graalvm-community' | ||
components: 'native-image' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install clojure tools | ||
uses: DeLaGuardo/setup-clojure@ac5052cad8ffe5039f26968da4b4a0ca88d00971 | ||
with: | ||
cli: latest | ||
bb: latest | ||
no-auth: ${{ env.LOCAL == 'true' }} | ||
|
||
- name: Setup Fortran | ||
uses: fortran-lang/setup-fortran@v1 | ||
id: setup-fortran | ||
with: | ||
compiler: gcc | ||
version: '13' | ||
|
||
# - name: Setup Haskell | ||
# uses: haskell-actions/setup@v2 | ||
|
||
# - name: Setup zig | ||
# uses: mlugg/setup-zig@v1 | ||
|
||
- name: Setup Dart | ||
uses: dart-lang/setup-dart@v1 | ||
|
||
- name: Set up PyPy | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 'pypy3.10' | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22.11.0' | ||
|
||
- uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version: '1.1.34' | ||
|
||
- name: Cache Homebrew | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
/opt/Homebrew | ||
/opt/Caskroom | ||
key: ${{ runner.os }}-brew-${{ hashFiles('Brewfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-brew- | ||
- name: Brew Install hyperfine and various languages and tools | ||
run: brew bundle --file=Brewfile | ||
|
||
- name: Compile Hello World programs | ||
run: | | ||
cd hello-world | ||
bash ../compile.sh | ||
continue-on-error: true | ||
|
||
- name: Run Hello World benchmarks | ||
run: | | ||
cd hello-world | ||
bash ../run.sh | ||
continue-on-error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
|
||
*.class | ||
code | ||
.idea/ | ||
*.user | ||
*.o | ||
*.ali | ||
.aider* | ||
.env | ||
.env | ||
node_modules/ | ||
target/ | ||
build/ | ||
out/ | ||
dist/ | ||
*.log | ||
*.aux | ||
*.bbl | ||
*.blg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
brew "python@3.13" | ||
brew "rust" | ||
brew "go" | ||
brew "ruby" | ||
brew "zig" | ||
brew "hyperfine" | ||
brew "lua" | ||
brew "luajit" | ||
brew "odin" | ||
brew "elixir" | ||
brew "chezscheme" | ||
brew "mawk" | ||
brew "gnucobol" | ||
brew "vlang" | ||
brew "dart-sdk" | ||
cask "dotnet-sdk" | ||
brew "julia" | ||
brew "haskell-stack" | ||
brew "kotlin" | ||
cask "kotlin-native" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,51 @@ | ||
function compile { | ||
if [ -d ${1} ]; then | ||
echo "" | ||
echo "Compiling $1" | ||
${2} 2> /dev/null | ||
result=$? | ||
if [ $result -eq 1 ]; then | ||
echo "Failed to compile ${1} with command: ${2}" | ||
fi | ||
fi | ||
} | ||
|
||
clang -O3 c/code.c -o c/code | ||
clang++ -std=c++23 -march=native -O3 -Ofast -o cpp/code cpp/code.cpp | ||
go build -ldflags "-s -w" -o go/code go/code.go | ||
javac jvm/code.java | ||
bun build --bytecode --compile js/code.js --outfile js/bun | ||
native-image -O3 jvm.code | ||
RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build --manifest-path rust/Cargo.toml --release | ||
cargo build --manifest-path rust/Cargo.toml --release | ||
kotlinc -include-runtime kotlin/code.kt -d kotlin/code.jar | ||
kotlinc-native kotlin/code.kt -o kotlin/code -opt | ||
dart compile exe dart/code.dart -o dart/code --target-os=macos | ||
cd inko && inko build --opt=aggressive code.inko -o code && cd .. | ||
nim c -d:danger --opt:speed -d:passC -x:off -a:off nim/code.nim | ||
nim -d:release --threads:off --stackTrace:off --lineTrace:off --opt:speed -x:off -o:nim/code c nim/code.nim | ||
sbcl --noinform --non-interactive --load "common-lisp/code.lisp" --build | ||
fpc -O3 fpc/code.pas | ||
crystal build -o crystal/code --release crystal/code.cr | ||
scala-cli --power package scala/code.scala -f -o scala/code | ||
ldc2 -O3 -release -boundscheck=off -mcpu=native flto=thin d/code.d | ||
odin build odin/code.odin -o:speed -file -out:odin/code | ||
clang -O3 -framework Foundation objc/code.m -o objc/code | ||
gfortran -O3 fortran/code.f90 -o fortran/code | ||
zig build-exe -O ReleaseFast -femit-bin=zig/code zig/code.zig | ||
luajit -b lua/code.lua lua/code | ||
swiftc -O -parse-as-library -Xcc -funroll-loops -Xcc -march=native -Xcc -ftree-vectorize -Xcc -ffast-math swift/code.swift -o swift/code | ||
dotnet publish csharp -o csharp/code | ||
dotnet publish fsharp -o fsharp/code | ||
ghc -O2 -fllvm haskell/code.hs -o haskell/code || { echo "ghc: cannot compile with llvm backend; fallback to use default backend"; ghc -O2 haskell/code.hs -o haskell/code; } | ||
v -prod -cc clang -d no_backtrace -gc none -o v/code v/code.v | ||
emojicodec emojicode/code.emojic | ||
echo '(compile-program "chez/code.ss")' | chez --optimize-level 3 -q | ||
(cd clojure && mkdir -p classes && clojure -Sdeps '{:paths ["."]}' -M -e "(compile 'code)") | ||
cobc -I /opt/homebrew/include/ -O -O2 -O3 -Os -x -o cobol/main cobol/main.cbl | ||
lake build --dir lean4 | ||
#dotnet publish fsharp -o fsharp/code-aot /p:PublishAot=true /p:OptimizationPreference=Speed | ||
# haxe --class-path haxe -main Code --jvm haxe/code.jar # was getting errors running `haxelib install hxjava` | ||
#dotnet publish csharp -o csharp/code-aot /p:PublishAot=true /p:OptimizationPreference=Speed | ||
#gnatmake -O3 -gnat2022 -gnatp -flto ada/code.adb -D ada -o ada/code | ||
compile 'c' 'clang -O3 c/code.c -o c/code' | ||
compile 'cpp' 'clang++ -std=c++23 -march=native -O3 -Ofast -o cpp/code cpp/code.cpp' | ||
compile 'go' 'go build -ldflags "-s -w" -o go/code go/code.go' | ||
compile 'jvm' 'javac jvm/code.java' | ||
compile 'js' 'bun build --bytecode --compile js/code.js --outfile js/bun' | ||
compile 'jvm' 'native-image -O3 jvm.code' | ||
compile 'rust' 'RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build --manifest-path rust/Cargo.toml --release' | ||
compile 'rust' 'cargo build --manifest-path rust/Cargo.toml --release' | ||
compile 'kotlin' 'kotlinc -include-runtime kotlin/code.kt -d kotlin/code.jar' | ||
compile 'kotlin' 'kotlinc-native kotlin/code.kt -o kotlin/code -opt' | ||
compile 'dart' 'dart compile exe dart/code.dart -o dart/code --target-os=macos' | ||
compile 'inko' 'cd inko && inko build --opt=aggressive code.inko -o code && cd ..' | ||
compile 'nim' 'nim c -d:danger --opt:speed -d:passC -x:off -a:off nim/code.nim' | ||
compile 'nim' 'nim -d:release --threads:off --stackTrace:off --lineTrace:off --opt:speed -x:off -o:nim/code c nim/code.nim' | ||
compile 'sbcl' 'sbcl --noinform --non-interactive --load "common-lisp/code.lisp" --build' | ||
compile 'fpc' 'fpc -O3 fpc/code.pas' | ||
compile 'crystal' 'crystal build -o crystal/code --release crystal/code.cr' | ||
compile 'scala' 'scala-cli --power package scala/code.scala -f -o scala/code' | ||
compile 'scala' 'scala-cli --power package --native scala/code.scala -f -o scala/code-native --native-mode release-full' | ||
compile 'ldc2' 'ldc2 -O3 -release -boundscheck=off -mcpu=native flto=thin d/code.d' | ||
compile 'odin' 'odin build odin/code.odin -o:speed -file -out:odin/code' | ||
compile 'objc' 'clang -O3 -framework Foundation objc/code.m -o objc/code' | ||
compile 'fortran' 'gfortran -O3 fortran/code.f90 -o fortran/code' | ||
compile 'zig' 'zig build-exe -O ReleaseFast -femit-bin=zig/code zig/code.zig' | ||
compile 'lua' 'luajit -b lua/code.lua lua/code' | ||
compile 'swift' 'swiftc -O -parse-as-library -Xcc -funroll-loops -Xcc -march=native -Xcc -ftree-vectorize -Xcc -ffast-math swift/code.swift -o swift/code' | ||
compile 'csharp' 'dotnet publish csharp -o csharp/code' | ||
compile 'fsharp' 'dotnet publish fsharp -o fsharp/code' | ||
compile 'haskell' 'ghc -O2 -fllvm haskell/code.hs -o haskell/code || { echo "ghc: cannot compile with llvm backend; fallback to use default backend"; ghc -O2 haskell/code.hs -o haskell/code; }' | ||
compile 'v' 'v -prod -cc clang -d no_backtrace -gc none -o v/code v/code.v' | ||
compile 'emojicode' 'emojicodec emojicode/code.emojic' | ||
compile 'chez' "echo '(compile-program \"chez/code.ss\")' | chez --optimize-level 3 -q" | ||
compile 'clojure' "(cd clojure && mkdir -p classes && clojure -Sdeps '{:paths [\".\"]}' -M -e \"(compile 'code)\")" | ||
compile 'cobol' 'cobc -I /opt/homebrew/include/ -O -O2 -O3 -Os -x -o cobol/main cobol/main.cbl' | ||
compile 'lean4' 'lake build --dir lean4 ' | ||
# compile 'fsharp' 'dotnet publish fsharp -o fsharp/code-aot /p:PublishAot=true /p:OptimizationPreference=Speed' | ||
# compile 'java' 'haxe --class-path haxe -main Code --jvm haxe/code.jar # was getting errors running `haxelib install hxjava`' | ||
# compile 'csharp' 'dotnet publish csharp -o csharp/code-aot /p:PublishAot=true /p:OptimizationPreference=Speed' | ||
# compile 'ada' 'gnatmake -O3 -gnat2022 -gnatp -flto ada/code.adb -D ada -o ada/code' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Hello World | ||
|
||
This program simply prints “Hello, World!” to standard output and then exits. | ||
It serves as a baseline, trivial test with minimal overhead to ensure that the environment is set up and functioning correctly. | ||
|
||
Below is the reference C program. | ||
All languages must do the same work and meet these requirements: | ||
- Print exactly one line of text: “Hello, World!\n” | ||
- Exit with a successful status code. | ||
|
||
```C | ||
#include <stdio.h> | ||
|
||
int main() { | ||
printf("Hello, World!\n"); // All implementations must print "Hello, World!" followed by a newline character. | ||
return 0; // All implementations must terminate successfully. | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BEGIN { | ||
delete ARGV[1] | ||
print "Hello, World!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdio.h> | ||
|
||
int main() { | ||
printf("Hello, World!\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!chezscheme | ||
(import (chezscheme)) | ||
|
||
(display "Hello, World!") | ||
(newline) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(ns code | ||
(:gen-class)) | ||
|
||
(defn -main [& args] | ||
(println "Hello, world!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
IDENTIFICATION DIVISION. | ||
PROGRAM-ID. HelloWorld. | ||
|
||
PROCEDURE DIVISION. | ||
DISPLAY "Hello, World!" | ||
STOP RUN. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <iostream> | ||
|
||
int main() { | ||
std::cout << "Hello, World!" << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Console.WriteLine("Hello, World!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'dart:math'; | ||
|
||
void main(List<String> args) { | ||
print("Hello, World!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
IO.puts("Hello, World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
program main | ||
print *, "Hello, World!" | ||
end program main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
open System | ||
|
||
[<EntryPoint>] | ||
let main argv = | ||
printfn "Hello, World!" | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net9.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="code.fs" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("Hello, World!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Main where | ||
|
||
main :: IO () | ||
main = putStrLn "Hello, World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Hello, World!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package jvm; | ||
|
||
public class code { | ||
public static void main(String[] args) { | ||
System.out.println("Hello, world!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fun main() { | ||
println("Hello, world!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Hello, World!") |
Oops, something went wrong.