mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-25 02:23:22 +00:00
Prepare consistent Chunk sizes and fresh Fast Fetch integration
This commit is contained in:
1 parent
ce0524d49f
commit
d1e4c34054
24 files changed
+2042
-14
No files matched your search
@@ -0,0 +1,23 @@
|
||||
const { writeFileSync } = require('node:fs');
|
||||
const { RTCDataChannel } = require('werift');
|
||||
|
||||
const output = process.env.LIVESYNC_BENCH_DATACHANNEL_JSON;
|
||||
if (!output) throw new Error('LIVESYNC_BENCH_DATACHANNEL_JSON is required');
|
||||
const channels = new Set();
|
||||
const originalSend = RTCDataChannel.prototype.send;
|
||||
RTCDataChannel.prototype.send = function (...args) {
|
||||
channels.add(this);
|
||||
return originalSend.apply(this, args);
|
||||
};
|
||||
process.once('exit', () => {
|
||||
const rows = [...channels].map((channel) => ({ label: channel.label, payloadBytesSent: channel.bytesSent, messagesSent: channel.messagesSent }));
|
||||
const cpu = process.cpuUsage();
|
||||
writeFileSync(output, JSON.stringify({
|
||||
source: 'werift 0.24.4 RTCDataChannel counters; observed channels through a benchmark-only preload',
|
||||
scope: 'Application DataChannel payload; includes application retransmissions, excludes SCTP/DTLS/UDP/IP overhead, transport retransmissions, and relay signalling',
|
||||
payloadBytesSent: rows.reduce((sum, row) => sum + row.payloadBytesSent, 0),
|
||||
messagesSent: rows.reduce((sum, row) => sum + row.messagesSent, 0),
|
||||
processUsage: { userCpuMs: cpu.user / 1000, systemCpuMs: cpu.system / 1000, maxResidentSetKiB: process.resourceUsage().maxRSS },
|
||||
channels: rows,
|
||||
}, null, 2));
|
||||
});
|
||||
Reference in new issue
Block a user