Skip to content

Commit 5e4e795

Browse files
authored
Merge branch 'main' into update_csharp
2 parents 9ff3601 + c470d59 commit 5e4e795

Some content is hidden

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

57 files changed

+5808
-4811
lines changed

.github/lua.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
#!/usr/bin/bash
22

3+
set -euo pipefail
4+
5+
LUA_VERSION="5.4.6"
36
# https://www.lua.org/ftp/#
47
pushd /tmp
5-
curl -R -O http://www.lua.org/ftp/lua-5.4.4.tar.gz
6-
tar zxf lua-5.4.4.tar.gz
7-
pushd lua-5.4.4
8+
curl -L -R -O http://www.lua.org/ftp/lua-$LUA_VERSION.tar.gz
9+
tar zxf lua-$LUA_VERSION.tar.gz
10+
pushd lua-$LUA_VERSION
811
make all test
912
# sudo ln -sf $PWD/src/luac /usr/bin/luac
1013
# sudo ln -sf $PWD/src/lua /usr/bin/lua
1114
sudo make install
1215
popd
1316
popd
14-
# cp /tmp/lua-5.4.4/src/lua ./bench/include/lua/out
17+
# cp /tmp/lua-$LUA_VERSION/src/lua ./bench/include/lua/out
1518
luac -v
1619
lua -v
1720
# ./bench/include/lua/out/lua -v
1821

19-
git clone https://github.com/LuaJIT/LuaJIT.git /tmp/LuaJIT
22+
LUAJIT_VERSION=2.1.0-beta3
23+
git clone --branch v$LUAJIT_VERSION https://github.com/LuaJIT/LuaJIT.git /tmp/LuaJIT
2024
pushd /tmp/LuaJIT
2125
make
2226
sudo make install
23-
luajit-2.1.0-beta3 -v
24-
sudo ln -sf luajit-2.1.0-beta3 /usr/local/bin/luajit
27+
luajit-$LUAJIT_VERSION -v
28+
sudo ln -sf luajit-$LUAJIT_VERSION /usr/local/bin/luajit
2529
popd
2630
luajit -v
2731
# cp /tmp/LuaJIT/src/luajit ./bench/include/lua/out

.github/nim.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/bash
22

3+
set -euo pipefail
4+
35
curl https://nim-lang.org/choosenim/init.sh -sSf > choosenim.sh
46
sh choosenim.sh -y
57
sudo ln -sf $HOME/.nimble/bin/choosenim /usr/bin/choosenim

.github/odin.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/usr/bin/sh
1+
#!/usr/bin/bash
2+
3+
set -euo pipefail
24

35
VERSION=dev-2023-05
46
FILE_NAME=odin-ubuntu-amd64-$VERSION.zip

.github/v.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ cd /tmp/vlang
88
make && ./v -version
99
./v symlink
1010
v --version
11-
v install hanabi1224.biginteger || echo 'ignore failure'
11+
# v install hanabi1224.biginteger || echo 'ignore failure'

.github/workflows/bench.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
haxe,
4343
java,
4444
javascript,
45-
julia,
45+
# julia,
4646
kotlin,
4747
# lisp,
4848
lua,
@@ -69,7 +69,7 @@ jobs:
6969
- run: dotnet --info
7070
- uses: actions/setup-dotnet@v3
7171
with:
72-
dotnet-version: "7.x"
72+
dotnet-version: "8.x"
7373
- name: Install
7474
run: |
7575
echo '# placeholder' > $PROFILE
@@ -256,19 +256,19 @@ jobs:
256256
- run: lscpu
257257
- uses: actions/setup-dotnet@v3
258258
with:
259-
dotnet-version: "7.x"
259+
dotnet-version: "8.x"
260260
- name: Install
261261
run: |
262262
dotnet --info
263263
echo '# placeholder' > $PROFILE
264264
sudo apt-get update -y
265265
- uses: actions/checkout@v3
266-
- name: Check CPU Model
267-
run: |
268-
source $PROFILE
269-
pushd bench
270-
dotnet run -c Release --project tool -- --task checkcpu
271-
popd
266+
# - name: Check CPU Model
267+
# run: |
268+
# source $PROFILE
269+
# pushd bench
270+
# dotnet run -c Release --project tool -- --task checkcpu
271+
# popd
272272
- run: ./.github/acton.sh
273273
- run: ./.github/codon.sh
274274
- run: ./.github/clang.sh
@@ -331,10 +331,10 @@ jobs:
331331
- uses: actions/checkout@v3
332332
- uses: actions/setup-node@v3
333333
with:
334-
node-version: 14.x
334+
node-version: 18.x
335335
- uses: pnpm/action-setup@v2
336336
with:
337-
version: 7
337+
version: 8
338338
- uses: actions/download-artifact@v3
339339
with:
340340
# Artifact name

.github/workflows/site.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
- uses: actions/checkout@v3
2020
- uses: actions/setup-node@v3
2121
with:
22-
node-version: 14.x
22+
node-version: 18.x
2323
- uses: pnpm/action-setup@v2
2424
with:
25-
version: 7
25+
version: 8
2626
- run: pnpm --version
2727
- run: vercel --version
2828
- name: Build

bench/algorithm/binarytrees/1.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const Node = struct {
5151
right: ?*Self = null,
5252

5353
pub fn init(allocator: Allocator) !*Self {
54-
var node = try allocator.create(Self);
54+
const node = try allocator.create(Self);
5555
node.* = .{ .allocator = allocator };
5656
return node;
5757
}

bench/algorithm/edigits/1.zig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Pair = struct {
1515
pub fn main() !void {
1616
const stdout = std.io.getStdOut().writer();
1717
const n = try get_n();
18-
var k = binary_search(n);
18+
const k = binary_search(n);
1919
var pair = try sum_terms(0, k - 1);
2020
defer pair.deinit();
2121
var p = pair.p;
@@ -33,9 +33,9 @@ pub fn main() !void {
3333
defer tmp.deinit();
3434
try bigint.Managed.mul(&tmp, &answer, &a);
3535
try bigint.Managed.divFloor(&answer, &a, &tmp, &q);
36-
var str = try answer.toString(global_allocator, 10, std.fmt.Case.lower);
36+
const str = try answer.toString(global_allocator, 10, std.fmt.Case.lower);
3737
var i: usize = 0;
38-
var n_usize = @as(usize, @as(u32, @bitCast(n)));
38+
const n_usize = @as(usize, @as(u32, @bitCast(n)));
3939
while (i < n_usize) {
4040
var sb = [10:0]u8{ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
4141
var j: usize = i;
@@ -54,14 +54,14 @@ pub fn main() !void {
5454

5555
fn sum_terms(a: i32, b: i32) anyerror!Pair {
5656
if (b == a + 1) {
57-
var p = try bigint.Managed.initSet(global_allocator, 1);
58-
var q = try bigint.Managed.initSet(global_allocator, b);
57+
const p = try bigint.Managed.initSet(global_allocator, 1);
58+
const q = try bigint.Managed.initSet(global_allocator, b);
5959
return Pair{
6060
.p = p,
6161
.q = q,
6262
};
6363
}
64-
var mid: i32 = @divFloor((a + b), 2);
64+
const mid: i32 = @divFloor((a + b), 2);
6565
var pair_left: Pair = try sum_terms(a, mid);
6666
defer pair_left.deinit();
6767
var pair_right: Pair = try sum_terms(mid, b);
@@ -85,7 +85,7 @@ fn binary_search(n: i32) i32 {
8585
b *= 2;
8686
}
8787
while (b - a > 1) {
88-
var m: i32 = @divFloor(a + b, 2);
88+
const m: i32 = @divFloor(a + b, 2);
8989
if (test_k(n, m)) {
9090
b = m;
9191
} else {
@@ -99,10 +99,10 @@ fn test_k(n: i32, k: i32) bool {
9999
if (k < 0) {
100100
return false;
101101
}
102-
var float_k: f64 = @floatFromInt(k);
103-
var float_n: f64 = @floatFromInt(n);
104-
var ln_k_factorial = float_k * (math.ln(float_k) - 1.0) + 0.5 * math.ln(math.tau);
105-
var log_10_k_factorial = ln_k_factorial / math.ln10;
102+
const float_k: f64 = @floatFromInt(k);
103+
const float_n: f64 = @floatFromInt(n);
104+
const ln_k_factorial = float_k * (math.log(f64, math.e, float_k) - 1.0) + 0.5 * math.log(f64, math.e, math.tau);
105+
const log_10_k_factorial = ln_k_factorial / math.ln10;
106106
return log_10_k_factorial >= float_n + 50.0;
107107
}
108108

bench/algorithm/fannkuch-redux/1.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
println('${sum}\nPfannkuchen(${n}) = ${flips}')
1515
}
1616

17-
[direct_array_access]
17+
@[direct_array_access]
1818
fn fannkuchredux(n int) (int, int) {
1919
mut perm1 := [32]int{}
2020
for i in 0 .. perm1.len {
@@ -77,7 +77,7 @@ fn fannkuchredux(n int) (int, int) {
7777
return n, n
7878
}
7979

80-
[direct_array_access; inline]
80+
@[direct_array_access; inline]
8181
fn swap(mut array [32]int, i int, j int) {
8282
tmp := array[i]
8383
array[i] = array[j]

bench/algorithm/fannkuch-redux/3-i.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ inline fn advance_array(_array: u128, count: *[16]u8) u128 {
114114

115115
fn fannkuchRedux(n: u4) [2]i32 {
116116
var _current: u128 = 0x0F_0E_0D_0C_0B_0A_09_08_07_06_05_04_03_02_01_00;
117-
var _count = [1]u8{0} ** 16;
117+
const _count = [1]u8{0} ** 16;
118118
var max_rev: i32 = 0;
119119

120120
// Trivial cases, not implemented

0 commit comments

Comments
 (0)