Skip to content

Commit 1aed686

Browse files
authored
Merge branch 'main' into chore/v-mandelbrot-update-deprecated
2 parents e72fa48 + 0bc7344 commit 1aed686

Some content is hidden

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

61 files changed

+11478
-9044
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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- run: dotnet --info
6868
- uses: actions/setup-dotnet@v3
6969
with:
70-
dotnet-version: "8.x"
70+
dotnet-version: "9.x"
7171
- name: Install
7272
run: |
7373
echo '# placeholder' > $PROFILE
@@ -254,7 +254,7 @@ jobs:
254254
- run: lscpu
255255
- uses: actions/setup-dotnet@v3
256256
with:
257-
dotnet-version: "8.x"
257+
dotnet-version: "9.x"
258258
- name: Install
259259
run: |
260260
dotnet --info
@@ -332,7 +332,7 @@ jobs:
332332
node-version: 18.x
333333
- uses: pnpm/action-setup@v2
334334
with:
335-
version: 8
335+
version: 9
336336
- uses: actions/download-artifact@v3
337337
with:
338338
# Artifact name
@@ -347,8 +347,10 @@ jobs:
347347
pushd website
348348
pnpm i
349349
pnpm content
350+
pnpm build
351+
pnpm archive-dist
350352
- name: Site Publish
351353
if: github.ref == 'refs/heads/main'
352354
env:
353355
VERCEL_PUBLISH_TOKEN: ${{ secrets.VERCEL_PUBLISH_TOKEN }}
354-
run: vercel website --prod --confirm -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'
356+
run: vercel website --prod --yes -t $VERCEL_PUBLISH_TOKEN || echo 'ignore errors'

.github/workflows/site.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
node-version: 18.x
2323
- uses: pnpm/action-setup@v2
2424
with:
25-
version: 8
26-
- run: pnpm --version
25+
version: 9
2726
- run: vercel --version
2827
- name: Build
2928
run: |
3029
cd website
3130
pnpm i
3231
pnpm build
32+
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

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.v

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ import strconv
55
import math.big
66
import math
77

8-
const (
9-
one = big.integer_from_int(1)
10-
ten = big.integer_from_int(10)
11-
)
8+
const one = big.integer_from_int(1)
9+
const ten = big.integer_from_int(10)
1210

1311
fn main() {
1412
mut n := 27

bench/algorithm/fannkuch-redux/2-m.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ fn pfannkuchenStats(first: usize, last: usize, n: u8, res: *Stats) void {
114114
stats.checksum += @as(i32, @intCast(flips)) * parity;
115115
perm = nextPermutation(perm, count[0..n]) orelse break;
116116
}
117-
_ = @atomicRmw(u32, &res.max_flips, .Max, stats.max_flips, .SeqCst);
118-
_ = @atomicRmw(i32, &res.checksum, .Add, stats.checksum, .SeqCst);
117+
_ = @atomicRmw(u32, &res.max_flips, .Max, stats.max_flips, .seq_cst);
118+
_ = @atomicRmw(i32, &res.checksum, .Add, stats.checksum, .seq_cst);
119119
}
120120

121121
pub fn main() !void {

bench/algorithm/fasta/1c.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// contributed by TeXitoi
66
// add compile-time calculation by hanabi1224
77

8-
#![feature(const_fn_floating_point_arithmetic)]
9-
108
use std::cmp::min;
119
use std::io::{self, BufWriter, Write};
1210

0 commit comments

Comments
 (0)