Skip to content

Commit 5bc68b3

Browse files
authored
Maintenance update 07-19-2026. (#516)
1 parent 4d4ac9a commit 5bc68b3

34 files changed

Lines changed: 363 additions & 316 deletions

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<BaseIntermediateOutputPath>target</BaseIntermediateOutputPath>
3+
<BaseIntermediateOutputPath>target/obj/$(MSBuildProjectName)</BaseIntermediateOutputPath>
44
<BaseOutputPath>target</BaseOutputPath>
55
<ServerGarbageCollection>true</ServerGarbageCollection>
66
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>

README.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The measured values are:
5050

5151
All values are presented as: `median`<sub`median absolute deviation`</sub>.
5252

53-
UPDATE: 2025-08-17
53+
UPDATE: 2026-07-19
5454

5555
# Test Cases
5656

@@ -391,38 +391,38 @@ Notes:
391391

392392
| Language | Time, s | Memory, MiB | Energy, J |
393393
| :--------------------- | ---------------------: | ------------------------------------------------: | ---------------------: |
394-
| C++/g++ | 0.064<sub>±0.000</sub> | 3.62<sub>±00.00</sub> + 85.55<sub>±00.44</sub> | 2.57<sub>±00.06</sub> |
395-
| Go | 0.070<sub>±0.000</sub> | 3.62<sub>±00.00</sub> + 0.00<sub>±00.00</sub> | 3.09<sub>±00.09</sub> |
396-
| Zig | 0.071<sub>±0.000</sub> | 1.50<sub>±00.12</sub> + 64.69<sub>±00.06</sub> | 2.94<sub>±00.01</sub> |
397-
| C++/clang++ | 0.075<sub>±0.000</sub> | 3.25<sub>±00.00</sub> + 64.48<sub>±00.19</sub> | 2.90<sub>±00.06</sub> |
398-
| V/clang | 0.100<sub>±0.000</sub> | 2.12<sub>±00.00</sub> + 200.44<sub>±00.69</sub> | 4.18<sub>±00.08</sub> |
399-
| Rust | 0.102<sub>±0.000</sub> | 2.00<sub>±00.00</sub> + 74.25<sub00.12</sub> | 4.05<sub>±00.06</sub> |
400-
| V/gcc | 0.106<sub>±0.001</sub> | 2.25<sub>±00.00</sub> + 211.06<sub02.06</sub> | 4.52<sub>±00.05</sub> |
401-
| Java | 0.113<sub>±0.000</sub> | 41.79<sub>±00.14</sub> + 107.88<sub03.81</sub> | 6.06<sub>±00.22</sub> |
402-
| Crystal | 0.144<sub>±0.000</sub> | 3.50<sub>±00.00</sub> + 89.88<sub00.00</sub> | 5.91<sub>±00.10</sub> |
403-
| Scala | 0.184<sub>±0.004</sub> | 66.51<sub>±00.15</sub> + 158.44<sub02.00</sub> | 10.67<sub>±00.30</sub> |
404-
| Node.js | 0.216<sub>±0.001</sub> | 46.88<sub>±00.06</sub> + 227.55<sub04.77</sub> | 10.68<sub>±00.15</sub> |
405-
| Nim/gcc | 0.293<sub>±0.000</sub> | 1.75<sub>±00.12</sub> + 582.06<sub01.00</sub> | 11.25<sub>±00.17</sub> |
406-
| Nim/clang | 0.295<sub>±0.001</sub> | 2.00<sub>±00.00</sub> + 603.44<sub05.06</sub> | 11.62<sub>±00.12</sub> |
407-
| Lua/luajit | 0.305<sub>±0.001</sub> | 2.50<sub>±00.00</sub> + 157.22<sub>±01.05</sub> | 12.36<sub>±00.17</sub> |
408-
| Julia | 0.419<sub>±0.002</sub> | 258.38<sub>±00.12</sub> + 215.71<sub03.03</sub> | 16.24<sub>±00.31</sub> |
409-
| Python/pypy | 0.617<sub>±0.003</sub> | 59.62<sub>±00.12</sub> + 247.16<sub00.04</sub> | 25.09<sub>±00.34</sub> |
410-
| Racket | 0.757<sub>±0.004</sub> | 109.51<sub>±00.71</sub> + 248.35<sub>±01.07</sub> | 30.05<sub>±00.58</sub> |
411-
| Ruby/truffleruby | 0.910<sub>±0.010</sub> | 197.81<sub01.44</sub> + 672.44<sub54.69</sub> | 61.70<sub00.61</sub> |
412-
| Lua | 1.230<sub>±0.005</sub> | 2.56<sub>±00.06</sub> + 283.84<sub>±00.75</sub> | 50.66<sub>±00.69</sub> |
413-
| Ruby (--jit) | 1.289<sub>±0.014</sub> | 23.96<sub>±00.03</sub> + 174.84<sub>±00.31</sub> | 54.03<sub01.54</sub> |
414-
| Ruby/truffleruby (JVM) | 1.363<sub>±0.033</sub> | 350.78<sub04.33</sub> + 506.71<sub28.12</sub> | 88.50<sub02.14</sub> |
415-
| Ruby/jruby | 1.491<sub>±0.021</sub> | 250.45<sub>±00.62</sub> + 577.06<sub02.31</sub> | 80.03<sub01.19</sub> |
416-
| Ruby | 1.992<sub>±0.027</sub> | 12.12<sub>±00.00</sub> + 183.69<sub>±00.50</sub> | 85.16<sub02.19</sub> |
417-
| Python | 2.096<sub>±0.012</sub> | 11.44<sub>±00.06</sub> + 181.46<sub>±01.00</sub> | 90.37<sub01.30</sub> |
394+
| Zig | 0.064<sub>±0.000</sub> | 1.99<sub>±00.02</sub> + 67.01<sub>±00.19</sub> | 2.65<sub>±00.02</sub> |
395+
| C++/g++ | 0.064<sub>±0.001</sub> | 4.13<sub>±00.07</sub> + 86.26<sub>±00.21</sub> | 2.55<sub>±00.04</sub> |
396+
| C++/clang++ | 0.066<sub>±0.000</sub> | 3.50<sub>±00.06</sub> + 63.30<sub>±00.15</sub> | 2.65<sub>±00.03</sub> |
397+
| Go | 0.070<sub>±0.001</sub> | 4.24<sub>±00.03</sub> + 0.00<sub>±00.00</sub> | 3.29<sub>±00.06</sub> |
398+
| Rust | 0.098<sub>±0.000</sub> | 2.22<sub>±00.04</sub> + 72.94<sub>±00.02</sub> | 3.89<sub>±00.02</sub> |
399+
| V/gcc | 0.111<sub>±0.001</sub> | 2.05<sub>±00.05</sub> + 232.05<sub01.95</sub> | 4.67<sub>±00.02</sub> |
400+
| Crystal | 0.116<sub>±0.001</sub> | 3.74<sub>±00.01</sub> + 89.94<sub00.01</sub> | 5.34<sub>±00.09</sub> |
401+
| V/clang | 0.118<sub>±0.000</sub> | 2.07<sub>±00.05</sub> + 219.86<sub00.78</sub> | 4.88<sub>±00.02</sub> |
402+
| Java | 0.161<sub>±0.002</sub> | 43.54<sub>±00.09</sub> + 116.76<sub02.21</sub> | 8.84<sub>±00.17</sub> |
403+
| Node.js | 0.207<sub>±0.001</sub> | 45.03<sub>±00.01</sub> + 172.08<sub00.27</sub> | 10.60<sub>±00.11</sub> |
404+
| Scala | 0.245<sub>±0.003</sub> | 63.09<sub>±00.08</sub> + 145.79<sub01.32</sub> | 14.72<sub>±00.42</sub> |
405+
| Nim/gcc | 0.293<sub>±0.001</sub> | 2.03<sub>±00.03</sub> + 584.95<sub04.18</sub> | 11.16<sub>±00.10</sub> |
406+
| Nim/clang | 0.301<sub>±0.001</sub> | 2.36<sub>±00.01</sub> + 579.63<sub03.36</sub> | 11.49<sub>±00.11</sub> |
407+
| Lua/luajit | 0.309<sub>±0.002</sub> | 2.71<sub>±00.06</sub> + 155.41<sub>±01.11</sub> | 12.79<sub>±00.36</sub> |
408+
| Python/pypy | 0.617<sub>±0.003</sub> | 62.12<sub>±00.05</sub> + 247.40<sub01.95</sub> | 25.07<sub>±00.34</sub> |
409+
| Julia | 0.680<sub>±0.001</sub> | 312.61<sub>±00.26</sub> + 227.17<sub02.18</sub> | 25.34<sub>±00.31</sub> |
410+
| Racket | 0.791<sub>±0.005</sub> | 114.28<sub>±00.14</sub> + 251.89<sub>±01.03</sub> | 31.12<sub>±00.36</sub> |
411+
| Ruby/truffleruby | 0.871<sub>±0.019</sub> | 231.12<sub02.61</sub> + 505.99<sub28.55</sub> | 59.37<sub01.37</sub> |
412+
| Lua | 1.056<sub>±0.003</sub> | 2.49<sub>±00.01</sub> + 200.06<sub>±00.13</sub> | 44.34<sub>±00.33</sub> |
413+
| Ruby (--jit) | 1.118<sub>±0.005</sub> | 15.30<sub>±00.08</sub> + 184.61<sub>±00.73</sub> | 45.68<sub00.68</sub> |
414+
| Ruby/truffleruby (JVM) | 1.219<sub>±0.055</sub> | 375.11<sub03.25</sub> + 365.16<sub31.23</sub> | 79.17<sub03.57</sub> |
415+
| Python | 1.725<sub>±0.007</sub> | 12.03<sub>±00.08</sub> + 181.09<sub00.84</sub> | 72.90<sub00.73</sub> |
416+
| Ruby | 1.794<sub>±0.022</sub> | 14.79<sub>±00.07</sub> + 180.84<sub>±00.18</sub> | 75.20<sub01.40</sub> |
417+
| Ruby/jruby | 3.094<sub>±0.053</sub> | 233.67<sub>±00.54</sub> + 877.14<sub>±01.42</sub> | 182.28<sub04.15</sub> |
418418

419419
# Tests Execution
420420

421421
## Environment
422422

423423
CPU: Intel(R) Xeon(R) E-2324G
424424

425-
Base Docker image: Debian GNU/Linux trixie/sid
425+
Base Docker image: Debian GNU/Linux forky/sid
426426

427427
| Language | Version |
428428
| ---------------- | ------------------------------- |
@@ -447,27 +447,27 @@ Base Docker image: Debian GNU/Linux trixie/sid
447447
| Lua | 5.4.7 |
448448
| Lua/luajit | 2.1.1748495995 |
449449
| MLton | 20241230 |
450-
| Nim | 2.2.4 |
451-
| Node.js | v24.5.0 |
452-
| OCaml | 5.3.0 |
453-
| Odin | dev-2025-08-nightly |
454-
| PHP | 8.4.11 |
450+
| Nim | 2.2.10 |
451+
| Node.js | v26.5.0 |
452+
| OCaml | 5.5.0 |
453+
| Odin | dev-2026-07-nightly:819fdc7 |
454+
| PHP | 8.4.23 |
455455
| Perl | v5.40.1 |
456-
| Python | 3.13.5 |
457-
| Python/pypy | 7.3.20-final0 for Python 3.11.13 |
458-
| Racket | "8.17" |
459-
| Ruby | 3.4.5p51 |
460-
| Ruby/jruby | 10.0.2.0 |
461-
| Ruby/truffleruby | 24.2.2 |
462-
| Rust | 1.89.0 |
463-
| Scala | 3.7.2 |
464-
| Swift | 6.1.2 |
456+
| Python | 3.14.6 |
457+
| Python/pypy | 7.3.23-final0 for Python 3.11.15 |
458+
| Racket | "9.2" |
459+
| Ruby | 4.0.6p0 |
460+
| Ruby/jruby | 10.1.0.0 |
461+
| Ruby/truffleruby | 34.0.1 |
462+
| Rust | 1.97.1 |
463+
| Scala | 3.8.4 |
464+
| Swift | 6.3.3 |
465465
| Tcl | 8.6 |
466-
| V | 0.4.11 b9e5757 |
467-
| Vala | 0.56.18 |
468-
| Zig | 0.14.1 |
469-
| clang/clang++ | 19.1.7 (3+b1) |
470-
| gcc/g++ | 14.2.0 |
466+
| V | 0.5.2 7647ce1 |
467+
| Vala | 0.56.19 |
468+
| Zig | 0.16.0 |
469+
| clang/clang++ | 22.1.8 (1+b1) |
470+
| gcc/g++ | 16.1.0 |
471471

472472
## Using Docker
473473

base64/go/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module benchmark
22

3-
go 1.23.0
3+
go 1.25.0
44

55
require (
66
benchmarks/common v0.0.0-00010101000000-000000000000
77
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d
88
)
99

1010
require (
11-
github.com/bytedance/sonic/loader v0.3.0 // indirect
12-
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
13-
golang.org/x/sys v0.35.0 // indirect
11+
github.com/bytedance/sonic/loader v0.5.1 // indirect
12+
github.com/klauspost/cpuid/v2 v2.4.0 // indirect
13+
golang.org/x/sys v0.47.0 // indirect
1414
)
1515

1616
replace benchmarks/common => ../../common/go

base64/go/go.sum

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
22
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
3-
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
4-
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
3+
github.com/bytedance/sonic/loader v0.5.1 h1:Ygpfa9zwRCCKSlrp5bBP/b/Xzc3VxsAW+5NIYXrOOpI=
4+
github.com/bytedance/sonic/loader v0.5.1/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
55
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
66
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
77
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
@@ -11,23 +11,26 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
1111
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1212
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1313
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
14-
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
15-
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
14+
github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
15+
github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
1616
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
1717
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1818
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1919
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2020
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
2121
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
22+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
2223
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
2324
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
2425
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
25-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
2626
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
27+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
28+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
29+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2730
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
2831
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
29-
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
30-
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
32+
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
33+
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
3134
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3235
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
3336
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

base64/test-nolib.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,18 @@ int decode(size_t size, const char *str, size_t *out_size, char *output) {
136136
return true;
137137
}
138138

139-
inline uint32_t to_uint32_t(const char *str) {
140-
uint64_t n;
141-
memcpy(&n, str, sizeof(n));
142-
return n;
139+
static inline uint32_t to_uint32_t(const char *str) {
140+
return ((uint32_t)(unsigned char)str[0] << 24) |
141+
((uint32_t)(unsigned char)str[1] << 16) |
142+
((uint32_t)(unsigned char)str[2] << 8);
143143
}
144144

145145
void encode(size_t size, const char *str, size_t *out_size, char *output) {
146146
char *out = output;
147147
const char *ends = str + (size - size % 3);
148148
uint64_t n;
149149
while (str != ends) {
150-
uint32_t n = __builtin_bswap32(to_uint32_t(str));
150+
uint32_t n = to_uint32_t(str);
151151
*out++ = chars[(n >> 26) & 63];
152152
*out++ = chars[(n >> 20) & 63];
153153
*out++ = chars[(n >> 14) & 63];
@@ -156,14 +156,14 @@ void encode(size_t size, const char *str, size_t *out_size, char *output) {
156156
}
157157
int pd = size % 3;
158158
if (pd == 1) {
159-
n = (uint64_t)*str << 16;
159+
n = (uint64_t)(unsigned char)*str << 16;
160160
*out++ = chars[(n >> 18) & 63];
161161
*out++ = chars[(n >> 12) & 63];
162162
*out++ = '=';
163163
*out++ = '=';
164164
} else if (pd == 2) {
165-
n = (uint64_t)*str++ << 16;
166-
n |= (uint64_t)*str << 8;
165+
n = (uint64_t)(unsigned char)*str++ << 16;
166+
n |= (uint64_t)(unsigned char)*str << 8;
167167
*out++ = chars[(n >> 18) & 63];
168168
*out++ = chars[(n >> 12) & 63];
169169
*out++ = chars[(n >> 6) & 63];

base64/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def notify(msg)
3737
elsif desc.include?('JVM')
3838
engine = 'Ruby/truffleruby (JVM)'
3939
end
40-
elsif engine == 'ruby' && RubyVM::RJIT.enabled?
40+
elsif engine == 'ruby' && defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
4141
engine = 'Ruby (--jit)'
4242
end
4343

base64/test.zig

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
const std = @import("std");
2-
const unistd = @cImport(@cInclude("unistd.h"));
3-
4-
fn notify(msg: []const u8) void {
5-
const addr = std.net.Address.parseIp("127.0.0.1", 9001) catch unreachable;
6-
if (std.net.tcpConnectToAddress(addr)) |stream| {
7-
defer stream.close();
8-
_ = stream.write(msg) catch unreachable;
9-
} else |_| {}
2+
3+
fn milliTimestamp(io: std.Io) i64 {
4+
return std.Io.Clock.awake.now(io).toMilliseconds();
5+
}
6+
7+
fn notify(io: std.Io, msg: []const u8) void {
8+
const addr = std.Io.net.IpAddress.parse("127.0.0.1", 9001) catch unreachable;
9+
var stream = addr.connect(io, .{ .mode = .stream }) catch return;
10+
defer stream.close(io);
11+
12+
var writer = stream.writer(io, &.{});
13+
writer.interface.writeAll(msg) catch return;
14+
writer.interface.flush() catch return;
1015
}
1116

1217
pub fn main() !void {
1318
var arena = std.heap.ArenaAllocator.init(std.heap.c_allocator);
1419
defer arena.deinit();
1520
const alloc = arena.allocator();
21+
const io = std.Io.Threaded.global_single_threaded.io();
1622

1723
const b64 = std.base64.standard;
1824
const fixtures: [2]struct { src: []const u8, dst: []const u8 } = .{
@@ -49,33 +55,33 @@ pub fn main() !void {
4955
var fb = std.heap.FixedBufferAllocator.init(buffer);
5056
const fb_alloc = fb.allocator();
5157

52-
const pid = unistd.getpid();
58+
const pid = std.posix.system.getpid();
5359
const pid_str = try std.fmt.allocPrint(alloc, "Zig\t{d}", .{pid});
5460

55-
notify(pid_str);
61+
notify(io, pid_str);
5662

5763
var i: i32 = 0;
5864
var s_encoded: usize = 0;
59-
const t1 = std.time.milliTimestamp();
65+
const t1 = milliTimestamp(io);
6066
while (i < TRIES) : (i += 1) {
6167
const str21 = fb_alloc.alloc(u8, encodeSize) catch unreachable;
6268
s_encoded += b64.Encoder.encode(str21, str1).len;
6369
fb_alloc.free(str21);
6470
}
65-
const t_encoded = @as(f64, @floatFromInt(std.time.milliTimestamp() - t1)) / std.time.ms_per_s;
71+
const t_encoded = @as(f64, @floatFromInt(milliTimestamp(io) - t1)) / std.time.ms_per_s;
6672

6773
i = 0;
6874
var s_decoded: usize = 0;
69-
const t2 = std.time.milliTimestamp();
75+
const t2 = milliTimestamp(io);
7076
while (i < TRIES) : (i += 1) {
7177
const str31 = fb_alloc.alloc(u8, decodeSize) catch unreachable;
7278
b64.Decoder.decode(str31, str2) catch unreachable;
7379
s_decoded += str31.len;
7480
fb_alloc.free(str31);
7581
}
76-
const t_decoded = @as(f64, @floatFromInt(std.time.milliTimestamp() - t2)) / std.time.ms_per_s;
82+
const t_decoded = @as(f64, @floatFromInt(milliTimestamp(io) - t2)) / std.time.ms_per_s;
7783

78-
notify("stop");
84+
notify(io, "stop");
7985

8086
std.debug.print("encode: {s}... to {s}...: {}, {d:.2}\n", .{ str1[0..4], str2[0..4], s_encoded, t_encoded });
8187
std.debug.print("decode: {s}... to {s}...: {}, {d:.2}\n", .{ str2[0..4], str3[0..4], s_decoded, t_decoded });

brainfuck/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ run[bf.php]:: run[%]: %
247247

248248
.PHONY: clean
249249
clean: clean-go
250+
$(DOTNET_CLEAN) brainfuck.csproj
251+
$(DOTNET_CLEAN) brainfuck-staged.csproj
250252
$(DOTNET_CLEAN) fsharp/brainfuck.fsproj
251253
-rm -rf target
252254
-rm -rf zig-cache

brainfuck/bf-staged.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using dep org.scala-lang::scala3-staging::3.7.2
1+
//> using dep org.scala-lang::scala3-staging::3.8.4
22

33
import scala.quoted.*
44
import scala.collection.mutable.ArrayBuffer

brainfuck/bf.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ struct Op
1111
{
1212
public OpT op;
1313
public int v;
14-
public Op[]? loop;
14+
public Op[] loop;
1515

1616
public Op(OpT _op, int _v)
1717
{
1818
op = _op;
1919
v = _v;
20-
loop = null;
20+
loop = Array.Empty<Op>();
2121
}
2222

2323
public Op(OpT _op, Op[] _l)
@@ -122,7 +122,7 @@ private void _run(Op[] program, ref Tape tape)
122122
{
123123
case OpT.INC: tape.Inc(op.v); break;
124124
case OpT.MOVE: tape.Move(op.v); break;
125-
case OpT.LOOP: while (tape.CurrentCell > 0) _run(op.loop!, ref tape); break;
125+
case OpT.LOOP: while (tape.CurrentCell > 0) _run(op.loop, ref tape); break;
126126
case OpT.PRINT: p.Print(tape.CurrentCell); break;
127127
}
128128
}

0 commit comments

Comments
 (0)