refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
121
dev/env/node_modules/@streamparser/json/test/performance.ts
generated
vendored
Executable file
121
dev/env/node_modules/@streamparser/json/test/performance.ts
generated
vendored
Executable file
@@ -0,0 +1,121 @@
|
||||
import { runJSONParserTest } from "./utils/testRunner.js";
|
||||
import JSONParser from "../src/jsonparser.js";
|
||||
import { charset } from "../src/utils/utf-8.js";
|
||||
|
||||
const quote = String.fromCharCode(charset.QUOTATION_MARK);
|
||||
|
||||
const oneKB = 1024;
|
||||
const oneMB = 1024 * oneKB;
|
||||
const twoHundredMB = 200 * oneMB;
|
||||
const kbsIn200MBs = twoHundredMB / oneKB;
|
||||
|
||||
describe("performance", () => {
|
||||
describe("buffered parsing", () => {
|
||||
test("can handle large strings without running out of memory", async () => {
|
||||
await runJSONParserTest(
|
||||
new JSONParser({ stringBufferSize: 64 * 1024 }),
|
||||
function* () {
|
||||
const chunk = new Uint8Array(oneKB).fill(
|
||||
charset.LATIN_SMALL_LETTER_A,
|
||||
);
|
||||
yield quote;
|
||||
for (let index = 0; index < kbsIn200MBs; index++) {
|
||||
yield chunk;
|
||||
}
|
||||
yield quote;
|
||||
},
|
||||
({ value }) => expect((value as string).length).toEqual(twoHundredMB),
|
||||
);
|
||||
});
|
||||
|
||||
test("can handle large numbers without running out of memory", async () => {
|
||||
const jsonParser = new JSONParser({ numberBufferSize: 64 * 1024 });
|
||||
await runJSONParserTest(
|
||||
jsonParser,
|
||||
function* () {
|
||||
const chunk = new Uint8Array(oneKB).fill(charset.DIGIT_ONE);
|
||||
yield "1.";
|
||||
for (let index = 0; index < kbsIn200MBs; index++) {
|
||||
yield chunk;
|
||||
}
|
||||
},
|
||||
({ value }) => expect(value).toEqual(1.1111111111111112),
|
||||
);
|
||||
jsonParser.end();
|
||||
});
|
||||
});
|
||||
|
||||
test(`should keep memory stable if keepStack === false on array`, async () => {
|
||||
const chunk = new Uint8Array(oneKB).fill(charset.LATIN_SMALL_LETTER_A);
|
||||
chunk[0] = charset.QUOTATION_MARK;
|
||||
chunk[chunk.length - 1] = charset.QUOTATION_MARK;
|
||||
const commaChunk = new Uint8Array([charset.COMMA]);
|
||||
|
||||
const intialMemoryUsage = process.memoryUsage().heapUsed;
|
||||
const thirtyMBs = 20 * 1024 * 1024;
|
||||
let valuesLeft = kbsIn200MBs;
|
||||
|
||||
await runJSONParserTest(
|
||||
new JSONParser({
|
||||
paths: ["$.*"],
|
||||
keepStack: false,
|
||||
stringBufferSize: oneKB,
|
||||
}),
|
||||
function* () {
|
||||
yield new Uint8Array([charset.LEFT_SQUARE_BRACKET]);
|
||||
// decreasing so the number doesn't need to be reallocated
|
||||
for (let index = kbsIn200MBs; index > 0; index--) {
|
||||
yield chunk;
|
||||
yield commaChunk;
|
||||
}
|
||||
yield chunk;
|
||||
yield new Uint8Array([charset.RIGHT_SQUARE_BRACKET]);
|
||||
},
|
||||
() => {
|
||||
if (valuesLeft-- % oneKB !== 0) return;
|
||||
|
||||
const actualMemoryUsage = process.memoryUsage().heapUsed;
|
||||
expect(actualMemoryUsage - intialMemoryUsage < thirtyMBs).toBeTruthy();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test(`should keep memory stable if keepStack === false on object`, async () => {
|
||||
const chunk = new Uint8Array(oneKB).fill(charset.LATIN_SMALL_LETTER_A);
|
||||
chunk[0] = charset.QUOTATION_MARK;
|
||||
chunk[1] = charset.LATIN_SMALL_LETTER_A;
|
||||
chunk[2] = charset.QUOTATION_MARK;
|
||||
chunk[3] = charset.COLON;
|
||||
chunk[4] = charset.QUOTATION_MARK;
|
||||
chunk[chunk.length - 1] = charset.QUOTATION_MARK;
|
||||
const commaChunk = new Uint8Array([charset.COMMA]);
|
||||
|
||||
const intialMemoryUsage = process.memoryUsage().heapUsed;
|
||||
const thirtyMBs = 20 * 1024 * 1024;
|
||||
let valuesLeft = kbsIn200MBs;
|
||||
|
||||
await runJSONParserTest(
|
||||
new JSONParser({
|
||||
paths: ["$.*"],
|
||||
keepStack: false,
|
||||
stringBufferSize: oneKB,
|
||||
}),
|
||||
function* () {
|
||||
yield new Uint8Array([charset.LEFT_CURLY_BRACKET]);
|
||||
// decreasing so the number doesn't need to be reallocated
|
||||
for (let index = kbsIn200MBs; index > 0; index--) {
|
||||
yield chunk;
|
||||
yield commaChunk;
|
||||
}
|
||||
yield chunk;
|
||||
yield new Uint8Array([charset.RIGHT_CURLY_BRACKET]);
|
||||
},
|
||||
() => {
|
||||
if (valuesLeft-- % oneKB !== 0) return;
|
||||
|
||||
const actualMemoryUsage = process.memoryUsage().heapUsed;
|
||||
expect(actualMemoryUsage - intialMemoryUsage < thirtyMBs).toBeTruthy();
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user