wardite 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8542bfea8c7d257afcc7c5d9fa9f97dc816f18d462eadbee9ea6f2298c8f0f8
4
- data.tar.gz: 4dd3f1a5661c85295c1c38d07c424bfd5d1e979b6a8fa5d5efeb30a920696c85
3
+ metadata.gz: 3b374367cbbab2b2e5f937c73cff6c53df9c62f4c62653d294b28c683b015e59
4
+ data.tar.gz: b72512938d20ffdbdbb9537867fa0c631ab6455b51aae271d97f947bcca3126d
5
5
  SHA512:
6
- metadata.gz: 440f1234f039438fd744c46bbac0fc9280e7324863130dee3930474a20ace221d35c6e6437d2dec2e2d7c8568738d664982c84bcfe76440c12a9021c4cf07f5a
7
- data.tar.gz: dc114ee14a8412a674e724942a7ad6d8eaaad5af9debeeef2ef9a43dd5ee6322bd5e5ed32a87a75b02801f55081d15e0d6f2c1be262ea25783756234f7e85112
6
+ metadata.gz: 1af12383881dc3bac104e53bce974eccdcaef83cb4029b64395c75db05ffc8dc2d4a22030c97ae80a56e100cbe5e13fe56c6cf5e50439d5418c7f8f44448d262
7
+ data.tar.gz: 36e9b39213cde17b08235b9036f860a280f8bcc266a029b48c3f2d060387ec9fbe27101e14e3a0dd64e1f38cb5d9348711fe698209025ac3366676967a5a8eb1
data/Makefile CHANGED
@@ -2,8 +2,13 @@ SPINEL ?= spinel
2
2
  SPINELFLAGS ?= -O2
3
3
  RUBY ?= ruby
4
4
  BUILD_DIR ?= build
5
+ ZIG ?= zig
6
+ ZIG_GLIBC ?= 2.28
7
+ ZIG_MACOS ?= 13.0
8
+ ZIG_JOBS ?= 8
9
+ ZIG_TARGETS ?= aarch64-macos x86_64-linux aarch64-linux
5
10
 
6
- .PHONY: spinel spinel-test
11
+ .PHONY: spinel spinel-test spinel-zig
7
12
 
8
13
  # Keep inline RBS and the compiler's default integer overflow checks enabled.
9
14
  spinel:
@@ -12,3 +17,6 @@ spinel:
12
17
 
13
18
  spinel-test: spinel
14
19
  WARDITE_SPINEL_BIN="$(abspath $(BUILD_DIR)/wardite)" $(RUBY) -Ilib:test -e 'Dir["test/e2e/spinel*_test.rb"].each { |path| require_relative path }'
20
+
21
+ spinel-zig:
22
+ ZIG="$(ZIG)" $(RUBY) scripts/build_spinel_zig.rb "$(MAKE)" "$(BUILD_DIR)" "$(ZIG_GLIBC)" "$(ZIG_MACOS)" "$(ZIG_JOBS)" "$(SPINELFLAGS)" $(ZIG_TARGETS)
data/README.md CHANGED
@@ -90,9 +90,13 @@ the Wasm, links imports, and initializes a fresh instance. `--mir-dump` and
90
90
 
91
91
  The default `--mir-cache-verify checksum` checks the payload size and samples
92
92
  blocks. Use `--mir-cache-verify sha256` or Ruby's `mir_cache_verify: :sha256`
93
- to check the whole payload. Both modes use the same cache file and check MIR
94
- structure. Corruption outside the sampled blocks can go undetected in checksum
95
- mode, including changes that leave the MIR structurally valid.
93
+ to check the whole payload. Both modes use the same cache file. By default,
94
+ each function is restored and structurally checked before its first execution.
95
+ Use `--mir-cache-eager` or Ruby's `mir_cache_eager: true` to check every
96
+ function at load time. If a lazy check fails, Wardite stops and reports the
97
+ cache path. Delete that file and rerun. Corruption outside the sampled blocks
98
+ can go undetected in checksum mode, including changes that leave the MIR
99
+ structurally valid.
96
100
  [MIR2 cache measurements](docs/efflorescence-mir2-cache.md)
97
101
 
98
102
  For WASI commands, `--snapshot DIR` (with `--new-engine --mir-cache DIR`) saves
@@ -165,10 +169,38 @@ CRuby build. Ruby's dynamic export helpers (`instance.add(...)` and
165
169
  The build leaves inline RBS and Spinel's default integer overflow checks enabled.
166
170
  Wasm integer operations bound their intermediate values, so
167
171
  `--int-overflow=promote` is not required.
168
- The pinned Spinel build applies the IO::Buffer patches under `spinel/patches`.
172
+ CI builds Spinel from the upstream commit `58ee6361`, which includes the
173
+ required `IO::Buffer` changes.
169
174
  See the [build instructions and host memory API](docs/efflorescence-spinel-linear-memory.md).
170
175
  Override `SPINEL`, `SPINELFLAGS`, `BUILD_DIR`, or `RUBY` when needed.
171
176
 
177
+ #### Cross-compile from macOS with Zig
178
+
179
+ With Zig 0.17.1, Ruby, and the Xcode Command Line Tools installed, run:
180
+
181
+ ```sh
182
+ make spinel-zig
183
+ ```
184
+
185
+ The first build downloads and builds the same Spinel revision used in CI.
186
+ It builds the Spinel runtime and native StringIO code for each target and
187
+ uses Zig to compile and link the resulting Wardite executables.
188
+
189
+ | Target | Executable |
190
+ | --- | --- |
191
+ | macOS arm64 | `build/spinel-zig/aarch64-macos.13.0/wardite` |
192
+ | Linux x86_64 | `build/spinel-zig/x86_64-linux-gnu.2.28/wardite` |
193
+ | Linux arm64 | `build/spinel-zig/aarch64-linux-gnu.2.28/wardite` |
194
+
195
+ Linux builds dynamically link the target system's glibc. The default glibc
196
+ baseline is 2.28 and the macOS deployment target is 13.0. Set `ZIG_GLIBC`
197
+ or `ZIG_MACOS` to change those values. Use `ZIG` to select the compiler,
198
+ `ZIG_JOBS` to set parallelism, or `ZIG_TARGETS` to build a subset:
199
+
200
+ ```sh
201
+ make spinel-zig ZIG=/opt/homebrew/bin/zig ZIG_TARGETS=x86_64-linux
202
+ ```
203
+
172
204
  ## Contributing
173
205
 
174
206
  Bug reports and pull requests are welcome on GitHub at https://github.com/udzura/wardite.
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Pass Wardite's normal CLI arguments. Run on CRuby outside timing samples.
4
+ require "json"
5
+ require "wardite"
6
+ require "wardite/cli/cli"
7
+
8
+ module FunctionCoverage
9
+ DEFINED = {}
10
+ CALLS = Hash.new(0)
11
+
12
+ def initialize(function, *args)
13
+ @coverage_index = function.index
14
+ DEFINED[@coverage_index] = true
15
+ super
16
+ end
17
+
18
+ def acquire(destination)
19
+ CALLS[@coverage_index] += 1
20
+ super
21
+ end
22
+ end
23
+
24
+ Wardite::Efflorescence::FramePool.prepend(FunctionCoverage)
25
+ at_exit do
26
+ calls = FunctionCoverage::CALLS.values.sort.reverse
27
+ total = calls.sum
28
+ cumulative = 0
29
+ hot = calls.take_while do |count|
30
+ more = cumulative * 10 < total * 9
31
+ cumulative += count
32
+ more
33
+ end
34
+ warn JSON.generate(defined: FunctionCoverage::DEFINED.size, used: calls.size,
35
+ calls: total, functions_for_ninety_percent: hot.size)
36
+ end
37
+ Wardite::Cli::Cli.new(ARGV).run
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Usage: ruby benchmark/measure_mir_cache_restore.rb WASM BEFORE_BIN DIRECT_BIN [LAZY_BIN]
4
+ require "digest"
5
+ require "json"
6
+ require "open3"
7
+ require "tmpdir"
8
+
9
+ abort "Usage: ruby #{$PROGRAM_NAME} WASM BEFORE_BIN DIRECT_BIN [LAZY_BIN]" unless (3..4).cover?(ARGV.size)
10
+ wasm, *binaries = ARGV.map { |path| File.expand_path(path) }
11
+ runs = Integer(ENV.fetch("RUNS", "6"))
12
+ warmups = Integer(ENV.fetch("WARMUPS", "1"))
13
+ abort "Invalid run or warmup count" unless runs >= 3 && warmups >= 0
14
+ snapshot = ENV["SNAPSHOT"] == "1"
15
+
16
+ guest = ["--disable-gems", "-e", "puts RUBY_VERSION"]
17
+ expected, status = Open3.capture2("wasmtime", "run", wasm, *guest)
18
+ abort "Wasmtime did not run Ruby 4.0.9" unless status.success? && expected == "4.0.9\n"
19
+
20
+ macos = RUBY_PLATFORM.include?("darwin")
21
+ timer = macos ? ["/usr/bin/time", "-l"] : ["/usr/bin/time", "-f", "%M maximum RSS KiB"]
22
+ rss_pattern = macos ? /^\s*(\d+)\s+maximum resident set size$/ : /^(\d+) maximum RSS KiB$/
23
+ invoke = lambda do |command, *traces|
24
+ started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
25
+ stdout, stderr, status = Open3.capture3({"WARDITE_TRACE" => "1"}, *timer, *command, unsetenv_others: true)
26
+ total = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started
27
+ load = stderr[/^load_from_buffer: (\S+)$/, 1]
28
+ rss = stderr[rss_pattern, 1]
29
+ unless status.success? && stdout == expected && load && rss && traces.all? { |trace| stderr.include?(trace) }
30
+ abort "#{command.inspect}\n#{stdout}#{stderr}"
31
+ end
32
+ {load_seconds: Float(load), process_seconds: total, after_load_seconds: total - Float(load),
33
+ peak_rss_bytes: Integer(rss) * (macos ? 1 : 1024)}
34
+ end
35
+
36
+ samples = Dir.mktmpdir("wardite-mir-cache-restore") do |directory|
37
+ commands = %w[before direct lazy].zip(binaries).filter_map do |version, binary|
38
+ next unless binary
39
+ command = [binary, "--new-engine", "--mir-cache", File.join(directory, version)]
40
+ command += ["--snapshot", File.join(directory, "#{version}-snapshot")] if snapshot
41
+ [version, [*command, "--", wasm, *guest]]
42
+ end
43
+ miss = ["MIR2 cache miss:"]
44
+ hit = ["MIR2 cache hit:"]
45
+ if snapshot
46
+ miss << "snapshot saved:"
47
+ hit << "snapshot restored:"
48
+ end
49
+ commands.each { |_, command| invoke.call(command, *miss) }
50
+ (warmups + runs).times.flat_map do |iteration|
51
+ commands.rotate(iteration).filter_map do |version, command|
52
+ sample = invoke.call(command, *hit)
53
+ sample.merge(version: version, run: iteration - warmups + 1) if iteration >= warmups
54
+ end
55
+ end
56
+ end
57
+
58
+ puts JSON.pretty_generate(wasm_sha256: Digest::SHA256.file(wasm).hexdigest, guest_arguments: guest,
59
+ runs: runs, warmups: warmups, snapshot: snapshot, samples: samples)
@@ -0,0 +1,480 @@
1
+ {
2
+ "baseline": "f602d11dfa10551b717071b0f446b6aeb3ab2801",
3
+ "direct": "a38c88b",
4
+ "host": "Apple M3 Pro, macOS 27.0.1 arm64",
5
+ "spinel": "6e7fc1355 with Wardite patches, -O2",
6
+ "instrumented_guest": {
7
+ "runs": 10,
8
+ "warmups": 1,
9
+ "samples": [
10
+ {
11
+ "window_seconds": 0.8145610000938177,
12
+ "lazy_restore_seconds": 0.052095999009907246,
13
+ "guest_seconds": 0.7624650010839105,
14
+ "version": "lazy",
15
+ "run": 1
16
+ },
17
+ {
18
+ "window_seconds": 0.7607049997895956,
19
+ "lazy_restore_seconds": 0.0,
20
+ "guest_seconds": 0.7607049997895956,
21
+ "version": "direct",
22
+ "run": 1
23
+ },
24
+ {
25
+ "window_seconds": 0.7523850002326071,
26
+ "lazy_restore_seconds": 0.0,
27
+ "guest_seconds": 0.7523850002326071,
28
+ "version": "direct",
29
+ "run": 2
30
+ },
31
+ {
32
+ "window_seconds": 0.8101569996215403,
33
+ "lazy_restore_seconds": 0.05053100408986211,
34
+ "guest_seconds": 0.7596259955316782,
35
+ "version": "lazy",
36
+ "run": 2
37
+ },
38
+ {
39
+ "window_seconds": 0.8184700002893806,
40
+ "lazy_restore_seconds": 0.05160000687465072,
41
+ "guest_seconds": 0.7668699934147298,
42
+ "version": "lazy",
43
+ "run": 3
44
+ },
45
+ {
46
+ "window_seconds": 0.7665999997407198,
47
+ "lazy_restore_seconds": 0.0,
48
+ "guest_seconds": 0.7665999997407198,
49
+ "version": "direct",
50
+ "run": 3
51
+ },
52
+ {
53
+ "window_seconds": 0.7601359998807311,
54
+ "lazy_restore_seconds": 0.0,
55
+ "guest_seconds": 0.7601359998807311,
56
+ "version": "direct",
57
+ "run": 4
58
+ },
59
+ {
60
+ "window_seconds": 0.9087539999745786,
61
+ "lazy_restore_seconds": 0.056953003630042076,
62
+ "guest_seconds": 0.8518009963445365,
63
+ "version": "lazy",
64
+ "run": 4
65
+ },
66
+ {
67
+ "window_seconds": 0.811111000366509,
68
+ "lazy_restore_seconds": 0.05052099656313658,
69
+ "guest_seconds": 0.7605900038033724,
70
+ "version": "lazy",
71
+ "run": 5
72
+ },
73
+ {
74
+ "window_seconds": 0.7686399999074638,
75
+ "lazy_restore_seconds": 0.0,
76
+ "guest_seconds": 0.7686399999074638,
77
+ "version": "direct",
78
+ "run": 5
79
+ },
80
+ {
81
+ "window_seconds": 0.7530070003122091,
82
+ "lazy_restore_seconds": 0.0,
83
+ "guest_seconds": 0.7530070003122091,
84
+ "version": "direct",
85
+ "run": 6
86
+ },
87
+ {
88
+ "window_seconds": 0.8073429996147752,
89
+ "lazy_restore_seconds": 0.05137699190527201,
90
+ "guest_seconds": 0.7559660077095032,
91
+ "version": "lazy",
92
+ "run": 6
93
+ },
94
+ {
95
+ "window_seconds": 0.8177700000815094,
96
+ "lazy_restore_seconds": 0.05258399620652199,
97
+ "guest_seconds": 0.7651860038749874,
98
+ "version": "lazy",
99
+ "run": 7
100
+ },
101
+ {
102
+ "window_seconds": 0.7655939999967813,
103
+ "lazy_restore_seconds": 0.0,
104
+ "guest_seconds": 0.7655939999967813,
105
+ "version": "direct",
106
+ "run": 7
107
+ },
108
+ {
109
+ "window_seconds": 0.7676340001635253,
110
+ "lazy_restore_seconds": 0.0,
111
+ "guest_seconds": 0.7676340001635253,
112
+ "version": "direct",
113
+ "run": 8
114
+ },
115
+ {
116
+ "window_seconds": 0.814536000136286,
117
+ "lazy_restore_seconds": 0.051880001090466976,
118
+ "guest_seconds": 0.762655999045819,
119
+ "version": "lazy",
120
+ "run": 8
121
+ },
122
+ {
123
+ "window_seconds": 0.8386010001413524,
124
+ "lazy_restore_seconds": 0.05396999605000019,
125
+ "guest_seconds": 0.7846310040913522,
126
+ "version": "lazy",
127
+ "run": 9
128
+ },
129
+ {
130
+ "window_seconds": 0.7599679999984801,
131
+ "lazy_restore_seconds": 0.0,
132
+ "guest_seconds": 0.7599679999984801,
133
+ "version": "direct",
134
+ "run": 9
135
+ },
136
+ {
137
+ "window_seconds": 0.7704130001366138,
138
+ "lazy_restore_seconds": 0.0,
139
+ "guest_seconds": 0.7704130001366138,
140
+ "version": "direct",
141
+ "run": 10
142
+ },
143
+ {
144
+ "window_seconds": 0.8187699997797608,
145
+ "lazy_restore_seconds": 0.05262199370190501,
146
+ "guest_seconds": 0.7661480060778558,
147
+ "version": "lazy",
148
+ "run": 10
149
+ }
150
+ ]
151
+ },
152
+ "coverage": {
153
+ "RUBY_DESCRIPTION": {
154
+ "defined": 6049,
155
+ "used": 943,
156
+ "calls": 638815,
157
+ "functions_for_ninety_percent": 121
158
+ },
159
+ "require_relative": {
160
+ "defined": 6049,
161
+ "used": 975,
162
+ "calls": 640809,
163
+ "functions_for_ninety_percent": 121
164
+ }
165
+ },
166
+ "without_snapshot": {
167
+ "wasm_sha256": "5d87d7e932b9b698892711f065d5e0313ad7aad96f88a9693d05aaae02541669",
168
+ "guest_arguments": [
169
+ "--disable-gems",
170
+ "-e",
171
+ "puts RUBY_VERSION"
172
+ ],
173
+ "runs": 6,
174
+ "warmups": 1,
175
+ "snapshot": false,
176
+ "samples": [
177
+ {
178
+ "load_seconds": 0.34290289878845215,
179
+ "process_seconds": 1.1135909999720752,
180
+ "after_load_seconds": 0.7706881011836231,
181
+ "peak_rss_bytes": 938213376,
182
+ "version": "direct",
183
+ "run": 1
184
+ },
185
+ {
186
+ "load_seconds": 0.12636494636535645,
187
+ "process_seconds": 0.9431990003213286,
188
+ "after_load_seconds": 0.8168340539559722,
189
+ "peak_rss_bytes": 747208704,
190
+ "version": "lazy",
191
+ "run": 1
192
+ },
193
+ {
194
+ "load_seconds": 0.43359899520874023,
195
+ "process_seconds": 1.223624000325799,
196
+ "after_load_seconds": 0.7900250051170588,
197
+ "peak_rss_bytes": 1042432000,
198
+ "version": "before",
199
+ "run": 1
200
+ },
201
+ {
202
+ "load_seconds": 0.1324141025543213,
203
+ "process_seconds": 0.9510960001498461,
204
+ "after_load_seconds": 0.8186818975955248,
205
+ "peak_rss_bytes": 747208704,
206
+ "version": "lazy",
207
+ "run": 2
208
+ },
209
+ {
210
+ "load_seconds": 0.43831920623779297,
211
+ "process_seconds": 1.2125110002234578,
212
+ "after_load_seconds": 0.7741917939856648,
213
+ "peak_rss_bytes": 1040007168,
214
+ "version": "before",
215
+ "run": 2
216
+ },
217
+ {
218
+ "load_seconds": 0.34167003631591797,
219
+ "process_seconds": 1.1145270001143217,
220
+ "after_load_seconds": 0.7728569637984037,
221
+ "peak_rss_bytes": 936689664,
222
+ "version": "direct",
223
+ "run": 2
224
+ },
225
+ {
226
+ "load_seconds": 0.4361751079559326,
227
+ "process_seconds": 1.2107890001498163,
228
+ "after_load_seconds": 0.7746138921938837,
229
+ "peak_rss_bytes": 1039974400,
230
+ "version": "before",
231
+ "run": 3
232
+ },
233
+ {
234
+ "load_seconds": 0.34716224670410156,
235
+ "process_seconds": 1.125101000070572,
236
+ "after_load_seconds": 0.7779387533664703,
237
+ "peak_rss_bytes": 938229760,
238
+ "version": "direct",
239
+ "run": 3
240
+ },
241
+ {
242
+ "load_seconds": 0.13318181037902832,
243
+ "process_seconds": 0.9567999998107553,
244
+ "after_load_seconds": 0.8236181894317269,
245
+ "peak_rss_bytes": 747274240,
246
+ "version": "lazy",
247
+ "run": 3
248
+ },
249
+ {
250
+ "load_seconds": 0.3431978225708008,
251
+ "process_seconds": 1.1160440002568066,
252
+ "after_load_seconds": 0.7728461776860058,
253
+ "peak_rss_bytes": 936706048,
254
+ "version": "direct",
255
+ "run": 4
256
+ },
257
+ {
258
+ "load_seconds": 0.13000035285949707,
259
+ "process_seconds": 0.9456659997813404,
260
+ "after_load_seconds": 0.8156656469218433,
261
+ "peak_rss_bytes": 747208704,
262
+ "version": "lazy",
263
+ "run": 4
264
+ },
265
+ {
266
+ "load_seconds": 0.4298238754272461,
267
+ "process_seconds": 1.205783000215888,
268
+ "after_load_seconds": 0.7759591247886419,
269
+ "peak_rss_bytes": 1039974400,
270
+ "version": "before",
271
+ "run": 4
272
+ },
273
+ {
274
+ "load_seconds": 0.131148099899292,
275
+ "process_seconds": 0.9581930004060268,
276
+ "after_load_seconds": 0.8270449005067348,
277
+ "peak_rss_bytes": 747175936,
278
+ "version": "lazy",
279
+ "run": 5
280
+ },
281
+ {
282
+ "load_seconds": 0.44910287857055664,
283
+ "process_seconds": 1.2337160003371537,
284
+ "after_load_seconds": 0.784613121766597,
285
+ "peak_rss_bytes": 1037451264,
286
+ "version": "before",
287
+ "run": 5
288
+ },
289
+ {
290
+ "load_seconds": 0.3427419662475586,
291
+ "process_seconds": 1.1145379999652505,
292
+ "after_load_seconds": 0.7717960337176919,
293
+ "peak_rss_bytes": 938147840,
294
+ "version": "direct",
295
+ "run": 5
296
+ },
297
+ {
298
+ "load_seconds": 0.438244104385376,
299
+ "process_seconds": 1.2211520001292229,
300
+ "after_load_seconds": 0.7829078957438469,
301
+ "peak_rss_bytes": 1039990784,
302
+ "version": "before",
303
+ "run": 6
304
+ },
305
+ {
306
+ "load_seconds": 0.3471558094024658,
307
+ "process_seconds": 1.146732000168413,
308
+ "after_load_seconds": 0.7995761907659471,
309
+ "peak_rss_bytes": 938229760,
310
+ "version": "direct",
311
+ "run": 6
312
+ },
313
+ {
314
+ "load_seconds": 0.13216686248779297,
315
+ "process_seconds": 0.9570639999583364,
316
+ "after_load_seconds": 0.8248971374705434,
317
+ "peak_rss_bytes": 747143168,
318
+ "version": "lazy",
319
+ "run": 6
320
+ }
321
+ ]
322
+ },
323
+ "with_snapshot": {
324
+ "wasm_sha256": "5d87d7e932b9b698892711f065d5e0313ad7aad96f88a9693d05aaae02541669",
325
+ "guest_arguments": [
326
+ "--disable-gems",
327
+ "-e",
328
+ "puts RUBY_VERSION"
329
+ ],
330
+ "runs": 6,
331
+ "warmups": 1,
332
+ "snapshot": true,
333
+ "samples": [
334
+ {
335
+ "load_seconds": 0.34974002838134766,
336
+ "process_seconds": 0.4299139999784529,
337
+ "after_load_seconds": 0.08017397159710526,
338
+ "peak_rss_bytes": 890011648,
339
+ "version": "direct",
340
+ "run": 1
341
+ },
342
+ {
343
+ "load_seconds": 0.15814995765686035,
344
+ "process_seconds": 0.2430559997446835,
345
+ "after_load_seconds": 0.08490604208782315,
346
+ "peak_rss_bytes": 650723328,
347
+ "version": "lazy",
348
+ "run": 1
349
+ },
350
+ {
351
+ "load_seconds": 0.4435129165649414,
352
+ "process_seconds": 0.5446849996224046,
353
+ "after_load_seconds": 0.10117208305746317,
354
+ "peak_rss_bytes": 990756864,
355
+ "version": "before",
356
+ "run": 1
357
+ },
358
+ {
359
+ "load_seconds": 0.13663005828857422,
360
+ "process_seconds": 0.21904199989512563,
361
+ "after_load_seconds": 0.08241194160655141,
362
+ "peak_rss_bytes": 650788864,
363
+ "version": "lazy",
364
+ "run": 2
365
+ },
366
+ {
367
+ "load_seconds": 0.43425726890563965,
368
+ "process_seconds": 0.538143000099808,
369
+ "after_load_seconds": 0.10388573119416833,
370
+ "peak_rss_bytes": 992182272,
371
+ "version": "before",
372
+ "run": 2
373
+ },
374
+ {
375
+ "load_seconds": 0.34851908683776855,
376
+ "process_seconds": 0.4325800002552569,
377
+ "after_load_seconds": 0.08406091341748834,
378
+ "peak_rss_bytes": 888520704,
379
+ "version": "direct",
380
+ "run": 2
381
+ },
382
+ {
383
+ "load_seconds": 0.43475937843322754,
384
+ "process_seconds": 0.5403849999420345,
385
+ "after_load_seconds": 0.10562562150880694,
386
+ "peak_rss_bytes": 988102656,
387
+ "version": "before",
388
+ "run": 3
389
+ },
390
+ {
391
+ "load_seconds": 0.36879801750183105,
392
+ "process_seconds": 0.45832599978893995,
393
+ "after_load_seconds": 0.0895279822871089,
394
+ "peak_rss_bytes": 888684544,
395
+ "version": "direct",
396
+ "run": 3
397
+ },
398
+ {
399
+ "load_seconds": 0.14671897888183594,
400
+ "process_seconds": 0.23480799980461597,
401
+ "after_load_seconds": 0.08808902092278004,
402
+ "peak_rss_bytes": 650805248,
403
+ "version": "lazy",
404
+ "run": 3
405
+ },
406
+ {
407
+ "load_seconds": 0.3658318519592285,
408
+ "process_seconds": 0.4632270000874996,
409
+ "after_load_seconds": 0.0973951481282711,
410
+ "peak_rss_bytes": 890011648,
411
+ "version": "direct",
412
+ "run": 4
413
+ },
414
+ {
415
+ "load_seconds": 0.14462494850158691,
416
+ "process_seconds": 0.23942100023850799,
417
+ "after_load_seconds": 0.09479605173692107,
418
+ "peak_rss_bytes": 650788864,
419
+ "version": "lazy",
420
+ "run": 4
421
+ },
422
+ {
423
+ "load_seconds": 0.49601292610168457,
424
+ "process_seconds": 0.6129350000992417,
425
+ "after_load_seconds": 0.11692207399755716,
426
+ "peak_rss_bytes": 990134272,
427
+ "version": "before",
428
+ "run": 4
429
+ },
430
+ {
431
+ "load_seconds": 0.14013099670410156,
432
+ "process_seconds": 0.22823600005358458,
433
+ "after_load_seconds": 0.08810500334948301,
434
+ "peak_rss_bytes": 650788864,
435
+ "version": "lazy",
436
+ "run": 5
437
+ },
438
+ {
439
+ "load_seconds": 0.4383978843688965,
440
+ "process_seconds": 0.5424709999933839,
441
+ "after_load_seconds": 0.1040731156244874,
442
+ "peak_rss_bytes": 990756864,
443
+ "version": "before",
444
+ "run": 5
445
+ },
446
+ {
447
+ "load_seconds": 0.3496108055114746,
448
+ "process_seconds": 0.4302900000475347,
449
+ "after_load_seconds": 0.0806791945360601,
450
+ "peak_rss_bytes": 888537088,
451
+ "version": "direct",
452
+ "run": 5
453
+ },
454
+ {
455
+ "load_seconds": 0.4353821277618408,
456
+ "process_seconds": 0.5386159997433424,
457
+ "after_load_seconds": 0.10323387198150158,
458
+ "peak_rss_bytes": 988086272,
459
+ "version": "before",
460
+ "run": 6
461
+ },
462
+ {
463
+ "load_seconds": 0.35098719596862793,
464
+ "process_seconds": 0.4363919999450445,
465
+ "after_load_seconds": 0.08540480397641659,
466
+ "peak_rss_bytes": 889995264,
467
+ "version": "direct",
468
+ "run": 6
469
+ },
470
+ {
471
+ "load_seconds": 0.14019489288330078,
472
+ "process_seconds": 0.22449299972504377,
473
+ "after_load_seconds": 0.08429810684174299,
474
+ "peak_rss_bytes": 650772480,
475
+ "version": "lazy",
476
+ "run": 6
477
+ }
478
+ ]
479
+ }
480
+ }
@@ -6,7 +6,7 @@
6
6
 
7
7
  ## 背景
8
8
 
9
- [MIRCache#read](../../lib/wardite/efflorescence/mir_cache.rb) はキャッシュヒットのたびに、ペイロード全体のSHA-256を計算してヘッダーの値と照合する。Ruby 4.0.9のWasmではペイロードが約79 MiBある。
9
+ [MIRCache#read_functions](../../lib/wardite/efflorescence/mir_cache.rb) はキャッシュヒットのたびに、ペイロード全体のSHA-256を計算してヘッダーの値と照合する。Ruby 4.0.9のWasmではペイロードが約79 MiBある。
10
10
 
11
11
  Spinel版(`6f1a2c259`、`-O2`)でキャッシュヒット時の起動を `sample` で1回プロファイルした(1 ms間隔、1151サンプル。プロセス全体は約1.5秒)。`sp_crypto_sha256_block` が121サンプルで、取得できた区間の約1割を占めた。
12
12
 
@@ -1,6 +1,6 @@
1
1
  # ADR 0010: MIR2キャッシュからの関数復元の高速化
2
2
 
3
- - **状態** 提案
3
+ - **状態** 実装・計測済み。[計測記録](../efflorescence-mir2-cache.md#関数復元の計測)
4
4
  - **日付** 2026-11-12
5
5
  - **前提** [ruby.wasm対応フェーズ2](0008-efflorescence-ruby-wasm-phase2.md)、[MIR2キャッシュの実装記録](../efflorescence-mir2-cache.md)
6
6