Record the native entry measurement on Alpha

Every in-process entry made a prlimit64 system call; without it score.zi
takes 0.032 µs per call instead of 0.511, below Wasm.
This commit is contained in:
waozi committed 2026-11-18 12:52:44 -03:00
1 parent e6756bf62c
commit ac64565e50
3 files changed
+142

No files matched your search

+1
View File
@@ -2,6 +2,7 @@
## [Unreleased]
- In-process native ZX no longer makes a system call on every entry: each thread keeps its stack range, and a forked child looks it up again under its own limit. Records & calls (score.zi) went from 0.511 to 0.032 µs per call on Alpha and text_demo.zi from 0.512 to 0.033 µs; arrays, enums and loops took 13–30% less time.
## [0.7.0] - 2026-11-18
- Wasm now runs all three Kryon widget scenarios faster than Go, and two of them faster than C: Button takes 2.46 µs, Text 3.59 µs and Input 3.24 µs per two frames on Alpha, against 4.33, 3.89 and 6.59 µs in Go. Wasm code reads a record's fields where the record lies instead of copying it, builds records where their caller or parent keeps them, writes a single changed field in place, and writes zeroed records with wide stores or `memory.fill`. `zx2wasm --unbounded` makes a module with no step budget for runs that need none.
@@ -0,0 +1,120 @@
{
"schema_version": 1,
"host": "alpha",
"virtualization": "none",
"processor": "Intel Core i7-8700",
"base_revision": "6205d2f20a4e7a8b37fdbea9fa3de713bc36d4e9",
"candidate_revision": "e6756bf62c74d42054b883e1d6d2250e49c0c477",
"baseline": "Every native entry validates its thread stack range with getrlimit, a system call",
"candidate": "Each thread keeps its stack range; a forked child forgets the inherited range",
"methodology": "Physical Alpha. The site's in-process ZX example runner (bench/site_target_host.c, native backend) built against each revision's libziran.a; both run the same example bundles. 7 alternating rounds, 11 batches per run, every result checked against the example oracle. strace counted one prlimit64 call per entry before the change.",
"artifacts_sha256": {
"build/standard-ab/entry-stack/runner-base": "1dce6cf2e30675d17109551d5109ddd450edd30cfa4478b27e74a0ecdec78a4f",
"build/standard-ab/entry-stack/runner-new": "2ddea3bbc33c15ee3135daf1bd97b4a517cdabf6a8a8e9d5367ae75ff3cef691"
},
"results": {
"unit": "\u00b5s per call, median of each run's 11 batch medians",
"results": {
"score": {
"base": [
0.5106895751037598,
0.5089964597473144,
0.5140097037048339,
0.5105039381408691,
0.5112412400207519,
0.502059263458252,
0.513807221069336
],
"new": [
0.03160807772827148,
0.03202522203063965,
0.03232356266784668,
0.0322893829498291,
0.03292901602172851,
0.032265808837890625,
0.03234815994262696
]
},
"text_demo": {
"base": [
0.5116795964660645,
0.5123304745178222,
0.5123902283325195,
0.5114252635498048,
0.5081395556640625,
0.5010893546447753,
0.5143386533813477
],
"new": [
0.03277123960876465,
0.03283097885131836,
0.03269845637512207,
0.03284397917175293,
0.03295199621582031,
0.03264894076538086,
0.032971680404663084
]
},
"arrays": {
"base": [
3.213251955566406,
3.192574222412109,
3.2018723142089844,
3.182952379638672,
3.214308599121094,
3.2321179313964845,
3.196927500488281
],
"new": [
2.6321118203125002,
2.6386875107421877,
2.636773438964844,
2.6717936999511718,
2.671241207275391,
2.6164548325195316,
2.6523281267089844
]
},
"enums": {
"base": [
1.7725103825683592,
1.797301025390625,
1.7643009050292968,
1.7507519514160157,
1.7538234897460938,
1.7777304674072265,
1.7519919420166015
],
"new": [
1.2426726098632812,
1.2627570831298827,
1.2422338841552734,
1.2349490935058596,
1.2568846431884766,
1.2144278588867188,
1.2379082036132811
]
},
"loops": {
"base": [
4.295146485595703,
4.273789789306641,
4.226642588134766,
4.263681403320312,
4.325072019042969,
4.250410638671875,
4.309526135253907
],
"new": [
3.7268811137695312,
3.705994138671875,
3.7550324777832027,
3.7113249418945315,
3.7855954577636717,
3.722784429443359,
3.74658129296875
]
}
}
}
}
+21
View File
@@ -208,3 +208,24 @@ invocation matched the C digest.
leaves.
- Recursive calls carry a stack check and a frame; fib's recursive path
also takes a `jge` and a `jmp` back per call (native lane).
## Example programs: native entry
Every in-process native entry checked its cached stack range with
`getrlimit`, a system call: strace counted one `prlimit64` per call, about
0.48 µs of score.zi's 0.51 µs. Each thread now keeps its range, and a fork
handler clears the inherited one. Same bundles and runner source on Alpha,
µs per call ([raw samples](../bench/results/standard/native-entry-alpha.json)):
| Example | Before | After |
| --- | ---: | ---: |
| score.zi | 0.511 | 0.032 |
| text_demo.zi | 0.512 | 0.033 |
| arrays.zi | 3.202 | 2.639 |
| enums.zi | 1.764 | 1.242 |
| loops.zi | 4.274 | 3.727 |
Still open: arrays, enums and loops run 6–10× slower than C, while Wasm
is about even with C. Next, run the in-process column unbounded like C and
Wasm, then compare the loop code with V8's.