Skip to content

Commit cc9d350

Browse files
authored
Merge branch 'main' into main
2 parents 9696cfe + 0a30fb0 commit cc9d350

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+12184
-9099
lines changed

.github/lua.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -euo pipefail
44

5-
LUA_VERSION="5.4.6"
5+
LUA_VERSION="5.4.7"
66
# https://www.lua.org/ftp/#
77
pushd /tmp
88
curl -L -R -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz

.github/odin.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
set -euo pipefail
44

5-
VERSION=dev-2024-01
6-
FILE_NAME=odin-ubuntu-amd64-$VERSION.zip
5+
VERSION=dev-2024-11
6+
FILE_NAME=odin-linux-amd64-$VERSION.zip
77
sudo apt-get install -y aria2
8-
mkdir /tmp/odin
8+
mkdir /tmp/odin || true
99
cd /tmp/odin
1010
aria2c -c -o $FILE_NAME https://github.com/odin-lang/Odin/releases/download/$VERSION/$FILE_NAME
11-
if test -d ubuntu_artifacts; then sudo rm -rf ubuntu_artifacts; fi
1211
unzip -o $FILE_NAME
13-
if test -d ubuntu_artifacts; then ODIN_BIN_PATH=$PWD/ubuntu_artifacts/odin; else ODIN_BIN_PATH=$PWD/odin; fi
14-
sudo chmod +x $ODIN_BIN_PATH
12+
tar -xvf dist.tar.gz
13+
ODIN_BIN_PATH=$(pwd)/$(find */odin)
1514
sudo ln -sf $ODIN_BIN_PATH /usr/bin/odin
1615
odin version

.github/workflows/bench.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
runs-on: ${{ matrix.os }}
2121
strategy:
2222
fail-fast: true
23+
# fail-fast: false
2324
matrix:
2425
os: [ubuntu-22.04]
2526
lang: [
@@ -67,7 +68,7 @@ jobs:
6768
- run: dotnet --info
6869
- uses: actions/setup-dotnet@v3
6970
with:
70-
dotnet-version: "8.x"
71+
dotnet-version: "9.x"
7172
- name: Install
7273
run: |
7374
echo '# placeholder' > $PROFILE
@@ -227,10 +228,10 @@ jobs:
227228
pushd bench
228229
dotnet run -c Release --project tool -- --task test --langs ${{ matrix.lang }}
229230
popd
230-
- uses: actions/upload-artifact@v3
231+
- uses: actions/upload-artifact@v4
231232
if: github.ref == 'refs/heads/main'
232233
with:
233-
name: build
234+
name: build-${{ matrix.lang }}
234235
path: bench/build/**/*
235236
if-no-files-found: error
236237
gate:
@@ -254,7 +255,7 @@ jobs:
254255
- run: lscpu
255256
- uses: actions/setup-dotnet@v3
256257
with:
257-
dotnet-version: "8.x"
258+
dotnet-version: "9.x"
258259
- name: Install
259260
run: |
260261
dotnet --info
@@ -302,9 +303,10 @@ jobs:
302303
with:
303304
ruby-version: 3 # Not needed with a .ruby-version file
304305
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
305-
- uses: actions/download-artifact@v3
306+
- uses: actions/download-artifact@v4
306307
with:
307-
name: build
308+
pattern: build-*
309+
merge-multiple: true
308310
path: bench/build/
309311
- name: Bench
310312
run: |
@@ -313,7 +315,7 @@ jobs:
313315
dotnet run -c Release --project tool -- --task test --ignore-missing
314316
dotnet run -c Release --project tool -- --task bench --ignore-missing
315317
popd
316-
- uses: actions/upload-artifact@v3
318+
- uses: actions/upload-artifact@v4
317319
with:
318320
name: log
319321
path: bench/build/_results/**/*
@@ -332,8 +334,8 @@ jobs:
332334
node-version: 18.x
333335
- uses: pnpm/action-setup@v2
334336
with:
335-
version: 8
336-
- uses: actions/download-artifact@v3
337+
version: 9
338+
- uses: actions/download-artifact@v4
337339
with:
338340
# Artifact name
339341
name: log
@@ -347,8 +349,15 @@ jobs:
347349
pushd website
348350
pnpm i
349351
pnpm content
352+
pnpm build
353+
pnpm archive-dist
354+
env:
355+
GOOGLE_TAG_ID: ${{ secrets.GOOGLE_TAG_ID }}
350356
- name: Site Publish
351357
if: github.ref == 'refs/heads/main'
352358
env:
353359
VERCEL_PUBLISH_TOKEN: ${{ secrets.VERCEL_PUBLISH_TOKEN }}
354-
run: vercel website --prod --confirm -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'
360+
run: |
361+
npm i -g vercel
362+
vercel --version
363+
vercel website --prod --yes -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'

.github/workflows/site.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ jobs:
2222
node-version: 18.x
2323
- uses: pnpm/action-setup@v2
2424
with:
25-
version: 8
26-
- run: pnpm --version
25+
version: 9
26+
- run: npm i -g vercel
2727
- run: vercel --version
2828
- name: Build
2929
run: |
3030
cd website
3131
pnpm i
3232
pnpm build
33+
pnpm archive-dist

.github/zig.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/sh
22

3-
sudo snap install zig --classic --edge
3+
sudo snap install zig --classic --beta
44
zig version

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ _Once a change is merged into main branch, the CI job will re-generate and publi
1919

2020
## Main Goals
2121

22-
- Compare performance differences between different languages. Note that implementations might be using different optimizations, e.g. with or w/o multithreading, please do read the source code to check if it's a fair comparision or not.
22+
- Compare performance differences between different languages. Note that implementations might be using different optimizations, e.g. with or w/o multithreading, please do read the source code to check if it's a fair comparison or not.
2323
- Compare performance differences between different compilers or runtimes of the same language with the same source code.
2424
- Facilitate benchmarking on real server environments as nowadays more and more applications are deployed with docker/k8s. It's likely to get a very different result from what you get on your dev machine.
2525
- A reference for CI setup / Dev environment setup / package management setup for different languages. Refer to [Github action](https://github.com/hanabi1224/Programming-Language-Benchmarks/blob/main/.github/workflows/bench.yml)
2626
- It focuses more on new programming languages, classic
27-
programming languages that are covered by [CLBG](https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html) receive limited or no maintainence, based on their popularity.
27+
programming languages that are covered by [CLBG](https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html) receive limited or no maintenance, based on their popularity.
2828

2929
# [Website](https://programming-language-benchmarks.vercel.app/)
3030

@@ -57,7 +57,7 @@ _Current benchmarks problems and their implementations are from [The Computer La
5757

5858
## Prerequisites
5959

60-
[net7](https://dotnet.microsoft.com/)
60+
[net9](https://dotnet.microsoft.com/)
6161

6262
[nodejs 14](https://nodejs.org/)
6363

@@ -67,7 +67,7 @@ _Current benchmarks problems and their implementations are from [The Computer La
6767

6868
## Build
6969

70-
_The 1st step is to build source code from various of lanuages_
70+
_The 1st step is to build source code from various of languages_
7171

7272
```bash
7373
cd bench
@@ -123,16 +123,16 @@ Options:
123123
--force-rebuild A flag that indicates whether to force rebuild [default: False]
124124
--fail-fast A Flag that indicates whether to fail fast when error occurs [default: False]
125125
--build-pool A flag that indicates whether builds that can run in parallel [default: False]
126-
--verbose A Flag that indicates whether to print verbose infomation [default: False]
126+
--verbose A Flag that indicates whether to print verbose information [default: False]
127127
--no-docker A Flag that forces disabling docker [default: False]
128-
--langs <langs> Languages to incldue, e.g. --langs go csharp [default: ]
129-
--problems <problems> Problems to incldue, e.g. --problems binarytrees nbody [default: ]
130-
--environments <environments> OS environments to incldue, e.g. --environments linux windows [default: ]
128+
--langs <langs> Languages to include, e.g. --langs go csharp [default: ]
129+
--problems <problems> Problems to include, e.g. --problems binarytrees nbody [default: ]
130+
--environments <environments> OS environments to include, e.g. --environments linux windows [default: ]
131131
--version Show version information
132132
-?, -h, --help Show help and usage information
133133
```
134134

135-
## Referesh website
135+
## Refresh website
136136

137137
_Lastly you can re-generate website with latest benchmark numbers_
138138

@@ -146,9 +146,9 @@ serve dist
146146

147147
# TODOs
148148

149-
Intergrate test environment info into website
149+
Integrate test environment info into website
150150

151-
Intergrate build / test / benchmark infomation into website
151+
Integrate build / test / benchmark information into website
152152

153153
...
154154

bench/algorithm/binarytrees/1.act

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env runacton
2+
3+
class Node(object):
4+
left: ?Node
5+
right: ?Node
6+
def __init__(self, left, right):
7+
self.left = left
8+
self.right = right
9+
10+
def make(depth: int) -> Node:
11+
if depth == 0:
12+
return Node(None, None)
13+
else:
14+
d = depth - 1
15+
return Node(make(d), make(d))
16+
17+
def check(node: Node) -> int:
18+
l = node.left
19+
r = node.right
20+
sum = 1
21+
if l is not None:
22+
sum += check(l)
23+
if r is not None:
24+
sum += check(r)
25+
return sum
26+
27+
def binary_tree(n: int):
28+
min_depth = 4
29+
max_depth = max([min_depth + 2, n], 0)
30+
stretch_depth = max_depth + 1
31+
print("stretch tree of depth %d\t check: %d" % (stretch_depth, check(make(stretch_depth))))
32+
33+
long_lived_tree = make(max_depth)
34+
35+
mmd = max_depth + min_depth
36+
for d in range(min_depth, stretch_depth, 2):
37+
i = 2 ** (mmd - d)
38+
cs = 0
39+
for _ in range(0, i, 1):
40+
cs += check(make(d))
41+
print("%d\t trees of depth %d\t check: %d" % (i, d, cs))
42+
43+
print("long lived tree of depth %d\t check: %d" % (max_depth, check(long_lived_tree)))
44+
45+
actor main(env):
46+
n = int(env.argv[1]) if len(env.argv) > 1 else 6
47+
binary_tree(n)
48+
env.exit(0)

bench/algorithm/binarytrees/1.odin

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,63 @@
33
package main
44

55
import "core:fmt"
6-
import "core:strconv"
7-
import "core:os"
86
import "core:math"
97
import "core:mem"
8+
import "core:os"
9+
import "core:strconv"
1010

1111
MIN_DEPTH :: 4
1212
main :: proc() {
13-
n := strconv.parse_int(os.args[1]) or_else 10
14-
max_depth := math.max(MIN_DEPTH+2,n)
15-
{
16-
stretch_depth := max_depth + 1
17-
stretch_tree := makeTree(stretch_depth)
18-
defer { delete_tree(stretch_tree) }
19-
fmt.printf("stretch tree of depth %d\t check: %d\n", stretch_depth, check(stretch_tree) );
20-
}
21-
long_lived_tree := makeTree(max_depth)
22-
defer delete_tree(long_lived_tree)
23-
depth:int= MIN_DEPTH;
24-
for ;depth <= max_depth; depth += 2 {
25-
iterations := 1 << u8(max_depth - depth + MIN_DEPTH)
26-
sum: u64 = 0
27-
for _ in 0..<iterations {
28-
tree := makeTree(depth)
29-
defer { delete_tree(tree) }
30-
sum += u64(check(tree))
31-
}
32-
fmt.printf("%d\t trees of depth %d\t check: %d\n", iterations, depth, sum )
33-
}
13+
#no_bounds_check n := strconv.parse_int(os.args[1]) or_else 10
14+
max_depth := math.max(MIN_DEPTH + 2, n)
15+
{
16+
stretch_depth := max_depth + 1
17+
stretch_tree := makeTree(stretch_depth)
18+
defer {delete_tree(stretch_tree)}
19+
fmt.printf("stretch tree of depth %d\t check: %d\n", stretch_depth, check(stretch_tree))
20+
}
21+
long_lived_tree := makeTree(max_depth)
22+
defer delete_tree(long_lived_tree)
23+
depth: int = MIN_DEPTH
24+
for ; depth <= max_depth; depth += 2 {
25+
iterations := 1 << u8(max_depth - depth + MIN_DEPTH)
26+
sum: u64 = 0
27+
for _ in 0 ..< iterations {
28+
tree := makeTree(depth)
29+
defer {delete_tree(tree)}
30+
sum += u64(check(tree))
31+
}
32+
fmt.printf("%d\t trees of depth %d\t check: %d\n", iterations, depth, sum)
33+
}
3434

35-
fmt.printf("long lived tree of depth %d\t check: %d\n", max_depth, check(long_lived_tree))
35+
fmt.printf("long lived tree of depth %d\t check: %d\n", max_depth, check(long_lived_tree))
3636
}
3737

3838
Node :: struct {
39-
left,right:^Node,
39+
left, right: ^Node,
4040
}
4141

42-
makeTree::proc(depth:int)->^Node {
43-
node := new(Node)
44-
if node == nil {
45-
fmt.println("alloc error")
46-
return node
47-
}
48-
if depth > 0 {
49-
node.left = makeTree(depth-1)
50-
node.right = makeTree(depth-1)
51-
}
52-
return node
42+
makeTree :: proc(depth: int) -> ^Node {
43+
node := new(Node)
44+
if node == nil {
45+
fmt.println("alloc error")
46+
return node
47+
}
48+
if depth > 0 {
49+
node.left = makeTree(depth - 1)
50+
node.right = makeTree(depth - 1)
51+
}
52+
return node
5353
}
54-
delete_tree::proc(t:^Node){
55-
if t.left != nil {delete_tree(t.left)}
56-
if t.right != nil {delete_tree(t.right)}
57-
free(t)
54+
delete_tree :: proc(t: ^Node) {
55+
if t.left != nil {delete_tree(t.left)}
56+
if t.right != nil {delete_tree(t.right)}
57+
free(t)
5858
}
59-
check::proc(tree:^Node)->int {
60-
sum : int = 1
61-
if tree == nil { return 0 }
62-
sum += check(tree.left)
63-
sum += check(tree.right)
64-
return sum
59+
check :: proc(tree: ^Node) -> int {
60+
sum: int = 1
61+
if tree == nil {return 0}
62+
sum += check(tree.left)
63+
sum += check(tree.right)
64+
return sum
6565
}

bench/algorithm/binarytrees/1.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ fn check(node &Node) int {
2222
fn create(n int) &Node {
2323
if n == 0 {
2424
return &Node{
25-
left: 0
26-
right: 0
25+
left: unsafe { nil }
26+
right: unsafe { nil }
2727
}
2828
}
2929
return &Node{
30-
left: create(n - 1)
30+
left: create(n - 1)
3131
right: create(n - 1)
3232
}
3333
}

bench/algorithm/edigits/1.act

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
#!/usr/bin/env runacton
2+
13
# port of 1.py
4+
25
import math
36

47
ln_tau = math.log(6.283185307179586)
@@ -53,4 +56,4 @@ actor main(env):
5356
spaces += " "
5457
print(s[i:] + spaces + "\t:" + str(n))
5558
#print(f'{s[i:]}{" "*(10-n%10)}\t:{n}')
56-
await async env.exit(0)
59+
env.exit(0)

0 commit comments

Comments
 (0)