@wildshard/shard-format 0.32.0 → 0.34.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.
- package/package.json +1 -1
- package/src/format/boot-memory-cost.ts +42 -63
- package/src/format/memory-epoch.ts +6 -2
- package/src/format/memory-line.ts +16 -7
- package/src/format/phone-files.ts +83 -0
- package/src/format/shardfile-assets.ts +5 -4
- package/src/format/shardfile-stream-admit.ts +6 -1
- package/src/format/shardfileValidation.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/shard-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { controlFileHashes } from './admissionControl.ts'
|
|
2
2
|
import { textureMipBytes } from './contentBounds.ts'
|
|
3
|
+
import { contentBytes, gpuBytes, phoneInactiveFiles } from './phone-files.ts'
|
|
3
4
|
import { spawnViewSceneFiles } from './spawnView.ts'
|
|
4
5
|
import { parseImageAsset } from './stillImage.ts'
|
|
5
6
|
import { parseWorldScenes, worldScenesForTier } from './worldScenes.ts'
|
|
6
7
|
|
|
8
|
+
import type { TierIndex } from './phone-files.ts'
|
|
7
9
|
import type { Shardfile } from './shardSchema.ts'
|
|
8
10
|
import type { WorldScenesSection } from './worldScenes.ts'
|
|
9
11
|
|
|
@@ -22,10 +24,10 @@ interface BootMemoryCosts {
|
|
|
22
24
|
readonly phoneFloor?: number
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
/** MG6 epoch 4: what the offline estimate reads of a product, in bytes. */
|
|
27
|
+
/** MG6 epoch 4: what the offline estimate reads of a product, in bytes; from epoch 5 only the files a phone fetches. */
|
|
26
28
|
interface PhoneTerms {
|
|
27
|
-
/** Every client file's wire bytes plus its CPU-decoded bytes (audio aside), the commons the same way, and
|
|
28
|
-
* engine images the cook mounts: what a boot downloads and decodes. */
|
|
29
|
+
/** Every phone-tier client file's wire bytes plus its CPU-decoded bytes (audio aside), the commons the same way, and,
|
|
30
|
+
* for a data shard, the decoded engine images the cook mounts: what a boot downloads and decodes. */
|
|
29
31
|
readonly content: number
|
|
30
32
|
/** GPU texture bytes: image and KTX2 files, commons GPU and mounted images; zero for a runtime home, whose `gl` stands
|
|
31
33
|
* in (its files carry every tier's variants: Pine ships 704 MB of texture bytes and holds 65 MB on a phone at Low). */
|
|
@@ -50,25 +52,26 @@ const BASE_LEVEL = 1
|
|
|
50
52
|
// Chromium capture (04d76bcf). The calibrated increment rounds to 168 MB.
|
|
51
53
|
const SHADER_COMPILE_BYTES = 168_000_000
|
|
52
54
|
const MB = 1_000_000
|
|
53
|
-
const ENGINE_PLAYING_BYTES =
|
|
54
|
-
const ENGINE_LOADING_BYTES =
|
|
55
|
-
/** MG6 epoch
|
|
56
|
-
* `scripts/memory/phone-model.json`,
|
|
57
|
-
* WebContent and GPU processes through alpha or scale to an iPhone 17 Pro's WebContent
|
|
58
|
-
*
|
|
55
|
+
const ENGINE_PLAYING_BYTES = 730_889_000
|
|
56
|
+
const ENGINE_LOADING_BYTES = 968_046_000
|
|
57
|
+
/** MG6 epoch 7 (mini-em11c, 2026-11-18; epoch 6 mini-sweep): the estimate is ENGINE-MEMORY EM11's phone chain (engine
|
|
58
|
+
* `scripts/memory/phone-model.json`, read without the Web Inspector's Network retention: native WebKit [K] of the
|
|
59
|
+
* WebContent and GPU processes through alpha or scale to an iPhone 17 Pro's WebContent, at the 2048 MiB ActiveHard line).
|
|
60
|
+
* The terms are the product's alone; the engine term and every weight are what one engine build does with them, so the
|
|
61
|
+
* estimate follows the engine only through a sweep and a refit: `memory-calibration.em11.json` names the build (engine
|
|
62
|
+
* `50092092`, 99 cold runs, 6 per heavy zone), `memory-fit.mjs` fits this block from it and the golden pairs it. Each
|
|
59
63
|
* weight is phone bytes per product byte, fitted so that every pinned product's estimate is at or over the upper bound
|
|
60
|
-
* of EM11's error bar
|
|
61
|
-
* the
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* whose held bitmaps outweigh its terms; refit it when the engine's own boot gets cheaper. */
|
|
64
|
+
* of EM11's error bar over its cold runs (engine `upperOverRuns`, the 90% prediction bound on one more cold boot;
|
|
65
|
+
* epoch 6 used the highest run's), with each verdict kept at the 1.0 GB playing envelope and the 1.5 GB loading
|
|
66
|
+
* line. The fit is minimax, then least total overshoot; the content weight is held at 0.5 settled and 0.8 loading at
|
|
67
|
+
* least, so bytes a boot downloads and decodes always count. The terms count only the files a phone fetches
|
|
68
|
+
* (`phoneInactiveFiles`). Refit at every engine release, and after a memory cut that should reach the gates. */
|
|
66
69
|
const PHONE = {
|
|
67
70
|
engine: { playing: ENGINE_PLAYING_BYTES, loading: ENGINE_LOADING_BYTES },
|
|
68
71
|
content: { playing: 0.5, loading: 0.8 },
|
|
69
|
-
textures: { playing:
|
|
70
|
-
gl: { playing:
|
|
71
|
-
geometry: { playing: 0
|
|
72
|
+
textures: { playing: 0.8518, loading: 2.2277 },
|
|
73
|
+
gl: { playing: 2.1475, loading: 1.8758 },
|
|
74
|
+
geometry: { playing: 0, loading: 0.7399 },
|
|
72
75
|
/** A runtime home never reads under its own Simulator reading settled, nor under it times EM11's lowest peak over
|
|
73
76
|
* settled (1.257) while loading. No pinned home binds here today; it stops a heavy runtime with light files. */
|
|
74
77
|
runtime: { playing: 1, loading: 1.26 },
|
|
@@ -153,48 +156,13 @@ function paintArrayBytes(
|
|
|
153
156
|
return { paintArrayGpu, paintArrayStaging }
|
|
154
157
|
}
|
|
155
158
|
|
|
156
|
-
/** MG6 epoch
|
|
157
|
-
*
|
|
158
|
-
* and the engine images the cook mounts (Far Reach's sky and terrain textures: 107 MB of decoded bitmaps measured
|
|
159
|
-
* against 105 MB charged). */
|
|
160
|
-
function contentBytes(
|
|
161
|
-
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
162
|
-
shard: Shardfile,
|
|
163
|
-
mountedImages: number,
|
|
164
|
-
): number {
|
|
165
|
-
let bytes = mountedImages
|
|
166
|
-
for (const file of shard.files) {
|
|
167
|
-
bytes += file.compressed + (file.kind === 'audio' ? NO_BYTES : file.decoded)
|
|
168
|
-
}
|
|
169
|
-
for (const wire of Object.values(shard.requires.commonsWire)) {
|
|
170
|
-
bytes += wire
|
|
171
|
-
}
|
|
172
|
-
for (const row of Object.values(shard.requires.commonsCosts)) {
|
|
173
|
-
bytes += row.decoded
|
|
174
|
-
}
|
|
175
|
-
return bytes
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** The GPU bytes of the product's files of these kinds. */
|
|
179
|
-
function gpuBytes(
|
|
180
|
-
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
181
|
-
shard: Shardfile,
|
|
182
|
-
kinds: ReadonlySet<string>,
|
|
183
|
-
): number {
|
|
184
|
-
let bytes = NO_BYTES
|
|
185
|
-
for (const file of shard.files) {
|
|
186
|
-
if (kinds.has(file.kind)) {
|
|
187
|
-
bytes += file.gpu
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return bytes
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/** MG6 epoch 4: a product's terms. */
|
|
159
|
+
/** MG6 epoch 5: a product's terms without the `inactive` files. A runtime home's mounted images are left to its reading:
|
|
160
|
+
* a phone Low boot of Pine fetched none of its 99.6 MB of them (meta MEMORY-GATES, mini-pinemem2 `95a75759`). */
|
|
194
161
|
function phoneTerms(
|
|
195
162
|
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
196
163
|
shard: Shardfile,
|
|
197
164
|
mountedImages: number = NO_BYTES,
|
|
165
|
+
inactive: ReadonlySet<string> = new Set(),
|
|
198
166
|
): PhoneTerms {
|
|
199
167
|
const cost = shard.runtime?.cost
|
|
200
168
|
const commonsGpu = Object.values(shard.requires.commonsCosts).reduce(
|
|
@@ -202,13 +170,17 @@ function phoneTerms(
|
|
|
202
170
|
NO_BYTES,
|
|
203
171
|
)
|
|
204
172
|
return {
|
|
205
|
-
content: contentBytes(
|
|
173
|
+
content: contentBytes(
|
|
174
|
+
shard,
|
|
175
|
+
cost === undefined ? mountedImages : NO_BYTES,
|
|
176
|
+
inactive,
|
|
177
|
+
),
|
|
206
178
|
textures:
|
|
207
179
|
cost === undefined
|
|
208
|
-
? gpuBytes(shard, TEXTURE_KINDS) + commonsGpu + mountedImages
|
|
180
|
+
? gpuBytes(shard, TEXTURE_KINDS, inactive) + commonsGpu + mountedImages
|
|
209
181
|
: NO_BYTES,
|
|
210
182
|
gl: cost === undefined ? NO_BYTES : Math.ceil(cost.glMB * MB),
|
|
211
|
-
geometry: gpuBytes(shard, GEOMETRY_KINDS),
|
|
183
|
+
geometry: gpuBytes(shard, GEOMETRY_KINDS, inactive),
|
|
212
184
|
sims: Math.max(shard.budgets.sim.resident, shard.serverBudget.memory),
|
|
213
185
|
runtimeReading:
|
|
214
186
|
cost === undefined
|
|
@@ -250,20 +222,27 @@ function bootPhoneBytes(
|
|
|
250
222
|
return { playing, loading: Math.max(playing, phase('loading')) }
|
|
251
223
|
}
|
|
252
224
|
|
|
253
|
-
/** Boot memory
|
|
254
|
-
*
|
|
225
|
+
/** Boot memory outside the steady-state file and tile budgets. `product` carries what the caller has: the decoded size
|
|
226
|
+
* of the images the cook mounts (`mountedImageBytes`) and the output index, so the terms count only phone files. */
|
|
255
227
|
function bootMemoryCosts(
|
|
256
228
|
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
257
229
|
shard: Shardfile,
|
|
258
230
|
sections: ReadonlyMap<string, unknown>,
|
|
259
|
-
|
|
231
|
+
product: Readonly<{
|
|
232
|
+
mountedImages?: number
|
|
233
|
+
index?: TierIndex | undefined
|
|
234
|
+
}> = {},
|
|
260
235
|
): BootMemoryCosts {
|
|
261
236
|
const rawScene = sections.get('world/scenes')
|
|
262
237
|
const scene =
|
|
263
238
|
rawScene === undefined
|
|
264
239
|
? undefined
|
|
265
240
|
: worldScenesForTier(parseWorldScenes(rawScene), 'phone')
|
|
266
|
-
const terms = phoneTerms(
|
|
241
|
+
const terms = phoneTerms(
|
|
242
|
+
shard,
|
|
243
|
+
product.mountedImages ?? NO_BYTES,
|
|
244
|
+
phoneInactiveFiles(shard, product.index, sections),
|
|
245
|
+
)
|
|
267
246
|
const phone = bootPhoneBytes(terms)
|
|
268
247
|
return {
|
|
269
248
|
...spawnMemoryCosts(shard, sections),
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
* `runtimeCost` reading must have been taken against. It rises when the model changes what it charges (MG6 adds shader
|
|
3
3
|
* compile, load transients, far slabs and paint arrays); from then a reading from an older epoch is refused until the
|
|
4
4
|
* shard re-measures. A reading with no `epoch` is epoch 1, the model before MG6. */
|
|
5
|
-
const MEMORY_EPOCH =
|
|
5
|
+
const MEMORY_EPOCH = 7
|
|
6
6
|
/** MG6 epoch 4 (mini-estcal2) changed how the estimate converts a reading (EM11's chain), not how a reading is taken:
|
|
7
|
-
* epoch 3's paired Simulator WebContent + GL protocol stands, so a reading from epoch 3 on is current.
|
|
7
|
+
* epoch 3's paired Simulator WebContent + GL protocol stands, so a reading from epoch 3 on is current. Epoch 5
|
|
8
|
+
* (mini-em11b) refits that conversion to EM11 read without the Web Inspector's Network retention and counts only the
|
|
9
|
+
* files a phone fetches; epoch 6 (mini-sweep) refits it to an every-zone sweep on engine `50092092`; epoch 7 (mini-em11c) refits
|
|
10
|
+
* it to the same sweep read with EM11's 90% prediction bound over runs in place of the highest run. Readings are still
|
|
11
|
+
* taken as in epoch 3. */
|
|
8
12
|
const OLDEST_CURRENT_EPOCH = 3
|
|
9
13
|
const LEGACY_EPOCH = 1
|
|
10
14
|
|
|
@@ -4,6 +4,7 @@ import { bootMemoryCosts } from './boot-memory-cost.ts'
|
|
|
4
4
|
import { worstContentCost } from './budget.ts'
|
|
5
5
|
import { runtimeAccountedBytes, RuntimeCostSchema } from './runtimeCost.ts'
|
|
6
6
|
|
|
7
|
+
import type { TierIndex } from './phone-files.ts'
|
|
7
8
|
import type { Shardfile } from './shardSchema.ts'
|
|
8
9
|
|
|
9
10
|
/** J408 (Jake, 2026-11-17, after Nine crashed his iPhone 17 Pro at boot): the hard line. An estimate over it
|
|
@@ -57,20 +58,28 @@ function runtimeOfflineBytes(input: unknown): number {
|
|
|
57
58
|
})
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
/** What the offline estimate knows of the product beyond its sections: the decoded engine images its cook mounts
|
|
61
|
+
/** What the offline estimate knows of the product beyond its sections: the decoded engine images its cook mounts and,
|
|
62
|
+
* from MG6 epoch 5, the output index, so its terms count only the files a phone fetches. */
|
|
61
63
|
type MemoryContext =
|
|
62
64
|
| ReadonlyMap<string, unknown>
|
|
63
|
-
| Readonly<{
|
|
65
|
+
| Readonly<{
|
|
66
|
+
sections: ReadonlyMap<string, unknown>
|
|
67
|
+
mountedImages: number
|
|
68
|
+
index?: TierIndex
|
|
69
|
+
}>
|
|
64
70
|
|
|
65
|
-
function memoryContext(
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
function memoryContext(context: MemoryContext): Readonly<{
|
|
72
|
+
sections: ReadonlyMap<string, unknown>
|
|
73
|
+
mountedImages: number
|
|
74
|
+
index?: TierIndex
|
|
75
|
+
}> {
|
|
68
76
|
return context instanceof Map
|
|
69
77
|
? { sections: context, mountedImages: EMPTY_BYTES }
|
|
70
78
|
: // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- the union's other arm
|
|
71
79
|
(context as Readonly<{
|
|
72
80
|
sections: ReadonlyMap<string, unknown>
|
|
73
81
|
mountedImages: number
|
|
82
|
+
index?: TierIndex
|
|
74
83
|
}>)
|
|
75
84
|
}
|
|
76
85
|
|
|
@@ -80,7 +89,7 @@ function offlineMemoryIssues(
|
|
|
80
89
|
source: Shardfile,
|
|
81
90
|
context: MemoryContext,
|
|
82
91
|
): ReturnType<typeof hardLineIssue>[] {
|
|
83
|
-
const { sections, mountedImages } = memoryContext(context)
|
|
92
|
+
const { sections, mountedImages, index } = memoryContext(context)
|
|
84
93
|
const native = source.runtime?.cost
|
|
85
94
|
const runtime =
|
|
86
95
|
native === undefined ? EMPTY_BYTES : runtimeOfflineBytes(native)
|
|
@@ -90,7 +99,7 @@ function offlineMemoryIssues(
|
|
|
90
99
|
)
|
|
91
100
|
const cost = worstContentCost(source, {
|
|
92
101
|
commons: runtime + commons,
|
|
93
|
-
boot: bootMemoryCosts(source, sections, mountedImages),
|
|
102
|
+
boot: bootMemoryCosts(source, sections, { mountedImages, index }),
|
|
94
103
|
})
|
|
95
104
|
return (['playing', 'loading'] as const)
|
|
96
105
|
.filter((kind): boolean => cost[kind] > MEMORY_HARD_BYTES)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// MEMORY-GATES MG6 epoch 5 (mini-em11b): the files a phone never fetches, for the offline estimate's terms.
|
|
2
|
+
import { tierLibrarySteps } from './tierSelection.ts'
|
|
3
|
+
|
|
4
|
+
import type { Shardfile } from './shardSchema.ts'
|
|
5
|
+
import type { TierSelectionSource } from './tierSelection.ts'
|
|
6
|
+
|
|
7
|
+
const NO_BYTES = 0
|
|
8
|
+
|
|
9
|
+
/** The output index rows tier selection reads: the assembled Shardfile drops each file's `tier` and `variantOf`. */
|
|
10
|
+
interface TierIndex {
|
|
11
|
+
readonly files: readonly Readonly<{
|
|
12
|
+
hash: string
|
|
13
|
+
path: string
|
|
14
|
+
name?: string
|
|
15
|
+
tier?: 'phone' | 'desktop'
|
|
16
|
+
variantOf?: string
|
|
17
|
+
compressed?: number
|
|
18
|
+
}>[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The files a phone never fetches, by tier selection's own verdict (the selection boot compilation runs): the desktop
|
|
22
|
+
* tier's named files, the texture-mode alternatives a phone skips, the other tier's horizons and scene models. Empty
|
|
23
|
+
* when the caller has no output index, so the estimate then counts every file. */
|
|
24
|
+
function phoneInactiveFiles(
|
|
25
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- tier selection's source, only read
|
|
26
|
+
source: TierSelectionSource,
|
|
27
|
+
index: TierIndex | undefined,
|
|
28
|
+
sections: ReadonlyMap<string, unknown>,
|
|
29
|
+
): ReadonlySet<string> {
|
|
30
|
+
if (index === undefined) {
|
|
31
|
+
return new Set()
|
|
32
|
+
}
|
|
33
|
+
const steps = tierLibrarySteps(source, 'phone', { index, sections })
|
|
34
|
+
let step = steps.next()
|
|
35
|
+
while (step.done !== true) {
|
|
36
|
+
step = steps.next()
|
|
37
|
+
}
|
|
38
|
+
return step.value
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** MG6 epoch 3: what a boot downloads and decodes. Each client file's downloaded bytes, its CPU-decoded form (decoded
|
|
42
|
+
* audio is left out: a boot decodes only its sample set, and Nine and Open Plots decode none), the commons the same way,
|
|
43
|
+
* and the engine images the cook mounts (Far Reach's sky and terrain textures: 107 MB of decoded bitmaps measured
|
|
44
|
+
* against 105 MB charged). */
|
|
45
|
+
function contentBytes(
|
|
46
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
47
|
+
shard: Shardfile,
|
|
48
|
+
mountedImages: number,
|
|
49
|
+
inactive: ReadonlySet<string>,
|
|
50
|
+
): number {
|
|
51
|
+
let bytes = mountedImages
|
|
52
|
+
for (const file of shard.files) {
|
|
53
|
+
if (!inactive.has(file.hash)) {
|
|
54
|
+
bytes +=
|
|
55
|
+
file.compressed + (file.kind === 'audio' ? NO_BYTES : file.decoded)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const wire of Object.values(shard.requires.commonsWire)) {
|
|
59
|
+
bytes += wire
|
|
60
|
+
}
|
|
61
|
+
for (const row of Object.values(shard.requires.commonsCosts)) {
|
|
62
|
+
bytes += row.decoded
|
|
63
|
+
}
|
|
64
|
+
return bytes
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The GPU bytes of the product's files of these kinds. */
|
|
68
|
+
function gpuBytes(
|
|
69
|
+
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
70
|
+
shard: Shardfile,
|
|
71
|
+
kinds: ReadonlySet<string>,
|
|
72
|
+
inactive: ReadonlySet<string>,
|
|
73
|
+
): number {
|
|
74
|
+
let bytes = NO_BYTES
|
|
75
|
+
for (const file of shard.files) {
|
|
76
|
+
if (kinds.has(file.kind) && !inactive.has(file.hash)) {
|
|
77
|
+
bytes += file.gpu
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return bytes
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { contentBytes, gpuBytes, phoneInactiveFiles, type TierIndex }
|
|
@@ -15,7 +15,8 @@ import { worstContentCost, memoryTargetWarnings, nearbyContentCost } from "./bud
|
|
|
15
15
|
import { CONTENT_CAPS as C, MEMORY_GATES } from './contentBounds.ts';
|
|
16
16
|
import { staleRuntimeIssues } from './memory-epoch.ts';
|
|
17
17
|
import { MEMORY_HARD_BYTES, hardLineIssue, runtimeOfflineBytes } from './memory-line.ts';
|
|
18
|
-
import { bootMemoryCosts
|
|
18
|
+
import { bootMemoryCosts } from './boot-memory-cost.ts';
|
|
19
|
+
import type { TierIndex } from './phone-files.ts';
|
|
19
20
|
import { VIEW_DRAWS, viewDraws } from './view-draws.ts';
|
|
20
21
|
import { DEFAULT_GRAPH_BUDGET } from "./materialGraph.ts";
|
|
21
22
|
import { SCRIPT_LIMITS } from './scriptLimits.ts';
|
|
@@ -25,12 +26,12 @@ import type { IssueCodeOf } from './issue-codes.ts';
|
|
|
25
26
|
import { isNavigationData, navigationCost } from './navigationBytes.ts';
|
|
26
27
|
|
|
27
28
|
type PerformancePolicy = 'refuse' | 'warn';
|
|
28
|
-
interface PerformanceOptions { readonly policy: PerformancePolicy; readonly sections: ReadonlyMap<string, unknown>; readonly mountedImages?: number }
|
|
29
|
+
interface PerformanceOptions { readonly policy: PerformancePolicy; readonly sections: ReadonlyMap<string, unknown>; readonly mountedImages?: number; readonly index?: TierIndex }
|
|
29
30
|
|
|
30
31
|
// oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- format's shard row, only read
|
|
31
|
-
function reportMemory(source: Shardfile, nativeBytes: number, options: Readonly<{ sections: ReadonlyMap<string, unknown>; mountedImages?: number }>): PerformanceReport['memory'] {
|
|
32
|
+
function reportMemory(source: Shardfile, nativeBytes: number, options: Readonly<{ sections: ReadonlyMap<string, unknown>; mountedImages?: number; index?: TierIndex }>): PerformanceReport['memory'] {
|
|
32
33
|
const commons = nativeBytes + Object.values(source.requires.commonsCosts).reduce((sum, row) => sum + row.decoded + row.gpu, 0);
|
|
33
|
-
const budget = { commons, boot: bootMemoryCosts(source, options.sections, options
|
|
34
|
+
const budget = { commons, boot: bootMemoryCosts(source, options.sections, options) };
|
|
34
35
|
return { near: nearbyContentCost(source, source.spawn.x, source.spawn.z, budget), worst: worstContentCost(source, budget), playingLimit: C.playing, loadingLimit: C.loading };
|
|
35
36
|
}
|
|
36
37
|
/** A performance issue's code and its metric words. */
|
|
@@ -37,7 +37,12 @@ function admitHead(
|
|
|
37
37
|
preflightDeclaredCosts(shard, offlineMemoryAdmission('warn'))
|
|
38
38
|
})
|
|
39
39
|
withIssueCode('performance-targets', (): void => {
|
|
40
|
-
|
|
40
|
+
// MG6 epoch 5: the index lets the estimate count only the files a phone fetches (no mount bytes in the stream).
|
|
41
|
+
assertShardfileTargets(shard, 'warn', {
|
|
42
|
+
sections: payloads,
|
|
43
|
+
mountedImages: 0,
|
|
44
|
+
index,
|
|
45
|
+
})
|
|
41
46
|
})
|
|
42
47
|
return shard
|
|
43
48
|
}
|
|
@@ -237,7 +237,7 @@ export function validateShardfileFolder(files: ShardfileFiles, ports: ShardfileV
|
|
|
237
237
|
coded('runtime-files', (): void => { ports.runtimeImports?.(entry.path, decoder().decode(read(entry))); });
|
|
238
238
|
}
|
|
239
239
|
for (const path of files.paths()) if (!listed.has(path)) throw issueError('unlisted-file', `Unlisted output file: ${path}`);
|
|
240
|
-
const shard = admitShardfileFolder(coded('shard-schema', (): unknown => assembleOutputShardfile(index, payloads)), assets, ports.hash, 'warn', scripts, { sections: payloads, mountedImages });
|
|
240
|
+
const shard = admitShardfileFolder(coded('shard-schema', (): unknown => assembleOutputShardfile(index, payloads)), assets, ports.hash, 'warn', scripts, { sections: payloads, mountedImages, index });
|
|
241
241
|
checkWorldTargets(shard, payloads.get('world/targets'));
|
|
242
242
|
if (ports.hash(validationSourceBytes(shard)) !== index.build.sourceHash) throw issueError('source-hash', 'Output sections differ from the declared source hash');
|
|
243
243
|
return { index, shard, assets, sections: payloads, scripts, warnings, audio: shardfileRecordings({ cook, read: files.read, shard, assets }) };
|