mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
Assert the long soak's JS object growth from heap snapshots, and report compiled code, native memory and the used heap's slope apart
This commit is contained in:
1 parent
8bea1419f6
commit
909be62ae7
3 files changed
+173
-7
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createHeapSnapshotSizes } from './heapSnapshotSizes.mjs';
|
||||
|
||||
test('a streamed heap snapshot is sized per node type, however it is chunked', () => {
|
||||
const snapshot = JSON.stringify({
|
||||
snapshot: {
|
||||
meta: {
|
||||
node_fields: ['type', 'name', 'id', 'self_size', 'edge_count'],
|
||||
node_types: [['hidden', 'object', 'code'], 'string', 'number'],
|
||||
},
|
||||
node_count: 4,
|
||||
},
|
||||
nodes: [1, 0, 1, 100, 0, 2, 0, 2, 4000, 0, 1, 0, 3, 23, 0, 0, 0, 4, 7, 0],
|
||||
edges: [9, 9],
|
||||
strings: ['x'],
|
||||
});
|
||||
for (const size of [snapshot.length, 7, 1]) {
|
||||
const sizes = createHeapSnapshotSizes();
|
||||
for (let i = 0; i < snapshot.length; i += size)
|
||||
sizes.push(snapshot.slice(i, i + size));
|
||||
assert.deepEqual(sizes.result(), { object: 123, code: 4000, hidden: 7 });
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user