chore: import upstream snapshot with attribution
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped

This commit is contained in:
wehub-resource-sync
2026-07-13 12:29:30 +08:00
commit e7738de6d2
1723 changed files with 216139 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
fn answer() -> i32 {
return 40 + 2
}
pub fn main(world: World) -> Void raises {
let value: i32 = answer()
if value == 42 {
check world.out.write("math works\n")
} else {
check world.out.write("math broke\n")
}
}
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
pub fn main(world: World) -> Void raises {
var storage: [32]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var alloc: FixedBufAlloc = std.mem.fixedBufAlloc(storage)
var total: usize = 0
let first: Maybe<MutSpan<u8>> = std.mem.allocBytes(alloc, 16)
let second: Maybe<MutSpan<u8>> = std.mem.allocBytes(alloc, 8)
if first.has && second.has {
total = std.mem.len(first.value) + std.mem.len(second.value)
}
if total == 24 {
check world.out.write("arena\n")
}
}
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
pub fn main(world: World) -> Void raises {
check world.out.write("baseline hello\n")
}
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
pub fn main(world: World) -> Void raises {
var i: i32 = 0
var total: i32 = 0
while i < 200000 {
if i % 3 == 0 {
total = total + 1
} else {
total = total + 2
}
i = i + 1
}
if total > 0 {
check world.out.write("branches\n")
}
}
Binary file not shown.
+17
View File
@@ -0,0 +1,17 @@
pub fn main(world: World) -> Void raises {
let bytes: [11]u8 = [122, 101, 114, 111, 45, 98, 117, 102, 102, 101, 114]
var scratch: [11]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let span: Span<u8> = std.mem.span("zero-buffer")
let copied: usize = std.mem.copy(scratch, span)
var i: i32 = 0
var hits: i32 = 0
while i < 10000 {
if std.mem.eqlBytes(span, std.mem.span("zero-buffer")) {
hits = hits + 1
}
i = i + 1
}
if hits == 10000 && copied == 11 && scratch[0] == 122 as u8 && std.mem.len(span) == 11 {
check world.out.write("buffer\n")
}
}
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
use std.codec
pub fn main(world: World) -> Void raises {
var i: i32 = 0
var len: usize = 0
var checksum: u32 = 0
while i < 50000 {
len = std.codec.encodedVarintLen(300)
checksum = std.codec.crc32("zero benchmark payload")
i = i + 1
}
if len == 2 && checksum > 0 {
check world.out.write("codec\n")
}
}
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
fn value(i: i32) -> i32 raises [Odd] {
if i % 2 == 0 {
return i
}
raise Odd
}
pub fn main(world: World) -> Void raises {
var i: i32 = 0
var total: i32 = 0
while i < 50000 {
let item: i32 = rescue value(i) err 1
total = total + item
i = i + 1
}
if total > 0 {
check world.out.write("fallibility\n")
}
}
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
pub fn main(world: World) -> Void raises {
check world.out.write("fileio\n")
}
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
pub fn main(world: World) -> Void raises [NotFound, TooLarge, Io] {
let fs: Fs = std.fs.host()
var file: owned<File> = check std.fs.createOrRaise(fs, ".zero/bench/zero-fs-resource.txt")
check std.fs.writeAllOrRaise(&mut file, std.mem.span("fs resource payload\n"))
let size: usize = check std.fs.fileLenOrRaise(&mut file)
std.fs.close(&mut file)
var opened: owned<File> = check std.fs.openOrRaise(fs, ".zero/bench/zero-fs-resource.txt")
var buf: [32]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let read: usize = check std.fs.readOrRaise(&mut opened, buf)
if size == read && read > 0 {
check world.out.write("fs resource\n")
}
}
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
pub fn main(world: World) -> Void raises {
check world.out.write("hello benchmark\n")
}
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
pub fn main(world: World) -> Void raises {
let text: Span<u8> = "{\"ok\":true}"[0..11]
if std.mem.len(text) == 11 && std.mem.eqlBytes(text, "{\"ok\":true}"[0..11]) {
check world.out.write("json\n")
}
}
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
pub fn main(world: World) -> Void raises {
var dst: [16]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let copied: usize = std.mem.copy(dst, std.mem.span("mem copy fill\n"))
var i: i32 = 0
var total: usize = 0
while i < 20000 {
total = total + copied
i = i + 1
}
if total == 280000 && dst[0] == 109 as u8 {
check world.out.write("mem copy fill\n")
}
}
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
use math
use text
pub fn main(world: World) -> Void raises {
var i: i32 = 0
var total: i32 = 0
while i < 50000 {
total = total + mix(i)
i = i + 1
}
if total > 0 && labelOk() {
check world.out.write("module package\n")
}
}
@@ -0,0 +1,6 @@
fn mix(value: i32) -> i32 {
if value % 2 == 0 {
return value + 1
}
return value - 1
}
@@ -0,0 +1,3 @@
fn labelOk() -> Bool {
return true
}
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
[package]
name = "bench-module-package"
version = "0.1.0"
[targets.cli]
kind = "exe"
main = "src/main.0"
[repositoryGraph]
compilerInput = true
+9
View File
@@ -0,0 +1,9 @@
pub fn main(world: World) -> Void raises {
let net: Net = std.net.host()
let addr: Address = std.net.withTimeout(std.net.address("localhost", 8080_u16), std.time.ms(250))
let conn: Maybe<Conn> = std.net.connect(net, addr)
let method: HttpMethod = std.http.parseMethod("GET")
if !conn.has && std.mem.eql(std.net.dnsName(addr), "localhost") && method == std.http.parseMethod("GET") {
check world.out.write("networking\n")
}
}
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
pub fn main(world: World) -> Void raises {
let fs: Fs = std.fs.host()
let created: Maybe<owned<File>> = std.fs.create(fs, ".zero/bench/zero-owned-file.txt")
if created.has {
var file: owned<File> = created.value
if !std.fs.writeAll(&mut file, std.mem.span("owned file payload\n")) {
return
}
}
let opened: Maybe<owned<File>> = std.fs.open(fs, ".zero/bench/zero-owned-file.txt")
if opened.has {
var file: owned<File> = opened.value
let size: Maybe<usize> = std.fs.fileLen(&mut file)
if size.has && size.value > 0 {
check world.out.write("owned file\n")
}
}
}
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
fn add(a: i32, b: i32) -> i32 {
return a + b
}
fn mix(a: i32, b: i32, c: i32) -> i32 {
return add(a, b) + c
}
pub fn main(world: World) -> Void raises {
if mix(10, 20, 12) == 42 {
check world.out.write("42\n")
}
}
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
use std.parse
pub fn main(world: World) -> Void raises {
var i: i32 = 0
var digits: usize = 0
while i < 100000 {
digits = std.parse.scanDigits("1234567890abcdef")
i = i + 1
}
if digits == 10 && std.parse.isIdentifierStart("_") {
check world.out.write("parse\n")
}
}
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
type Token {
kind: i32,
offset: i32,
}
pub fn main(world: World) -> Void raises {
let token: Token = Token { kind: 1, offset: 7 }
if token.kind == 1 && token.offset == 7 {
check world.out.write("ident\n")
}
}
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
pub fn main(world: World) -> Void raises {
let fs: Fs = std.fs.host()
let created: Maybe<owned<File>> = std.fs.create(fs, ".zero/bench/zero-readall-input.txt")
if created.has {
var file: owned<File> = created.value
if !std.fs.writeAll(&mut file, std.mem.span("readall payload\n")) {
return
}
}
var storage: [64]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var alloc: FixedBufAlloc = std.mem.fixedBufAlloc(storage)
var i: i32 = 0
var hits: i32 = 0
while i < 1000 {
std.mem.reset(&mut alloc)
let body: Maybe<owned<ByteBuf>> = std.fs.readAll(alloc, fs, ".zero/bench/zero-readall-input.txt", 64)
if body.has {
var buf: owned<ByteBuf> = body.value
if std.mem.eqlBytes(std.mem.bufBytes(&buf), std.mem.span("readall payload\n")) {
hits = hits + 1
}
}
i = i + 1
}
if hits == 1000 {
check world.out.write("readall\n")
}
}
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
fn value(i: i32) -> i32 raises [Miss] {
if i % 4 == 0 {
return i
}
raise Miss
}
pub fn main(world: World) -> Void raises {
var i: i32 = 0
var total: i32 = 0
while i < 50000 {
let item: i32 = rescue value(i) err 2
total = total + item
i = i + 1
}
if total > 0 {
check world.out.write("rescue\n")
}
}
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
pub fn main(world: World) -> Void raises {
let view: Span<u8> = "zero-slices"[5..11]
var i: i32 = 0
var total: usize = 0
while i < 50000 {
if view[0] == 115 as u8 && view[5] == 115 as u8 {
total = total + std.mem.len(view)
}
i = i + 1
}
if total == 300000 {
check world.out.write("slices\n")
}
}
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
type Point {
x: i32,
y: i32,
}
pub fn main(world: World) -> Void raises {
let point: Point = Point { x: 20, y: 22 }
if point.x + point.y == 42 {
check world.out.write("42\n")
}
}
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
pub fn main(world: World) -> Void raises {
let checksum: u32 = std.codec.crc32Bytes(std.mem.span("zero hash payload\n"))
if checksum == 1120241454 {
check world.out.write("zero-hash ok\n")
}
}
Binary file not shown.