Skip to content

API reference / @jsprismarine/prismarine / world/changelog/changeLogCost

world/changelog/changeLogCost ​

Type Aliases ​

ChangeLogCost ​

ChangeLogCost = object

Defined in: packages/prismarine/src/world/changelog/changeLogCost.ts:9

What one sealed tick costs the change log, in counts rather than time, for reporting through reportProgress.

Properties ​

blockBytes ​

readonly blockBytes: number

Defined in: packages/prismarine/src/world/changelog/changeLogCost.ts:17

The estimated bytes of those entries, part of bytes.

blockEntries ​

readonly blockEntries: number

Defined in: packages/prismarine/src/world/changelog/changeLogCost.ts:15

How many of the entries are block or block entity field entries.

bytes ​

readonly bytes: number

Defined in: packages/prismarine/src/world/changelog/changeLogCost.ts:13

An estimate of the bytes the entries hold, from estimatePlainBytes.

entries ​

readonly entries: number

Defined in: packages/prismarine/src/world/changelog/changeLogCost.ts:11

The number of entries the tick appended.

Functions ​

changeLogCost() ​

changeLogCost(sealed): ChangeLogCost

Defined in: packages/prismarine/src/world/changelog/changeLogCost.ts:26

Counts one sealed tick's entries and estimates their bytes. The result depends only on the entries, so it is the same on every host.

Parameters ​

sealed ​

SealedTick

The tick to count.

Returns ​

ChangeLogCost

Its entry count and estimated bytes, in all and for blocks.


estimatePlainBytes() ​

estimatePlainBytes(value): number

Defined in: packages/prismarine/src/world/changelog/changeLogCost.ts:50

Estimates the payload bytes of a plain value: 8 for a number or bigint, 1 for a boolean, nothing for null, 2 for each UTF-16 code unit of a string or property name, the byte length of a typed array, and the sum of the parts for an array or object.

It is a logical size for comparing ticks and changes, not the heap size an engine allocates.

Parameters ​

value ​

PlainData

The value to measure.

Returns ​

number

Its estimated size in bytes.