0.2.88
This commit is contained in:
1 parent
df403c0aa7
commit
9e133628e5
17 files changed
+270
-34
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
// Deterministic broadcast/access-check simulation. Not a live WebSocket/DB benchmark.
|
||||
const durationSeconds = 10;
|
||||
const editsPerUserPerSecond = 2;
|
||||
for (const users of [5, 100, 300, 500]) {
|
||||
const checks = new Int32Array(users);
|
||||
const lastCheckSecond = new Int32Array(users).fill(-1);
|
||||
const start = performance.now();
|
||||
let fanouts = 0;
|
||||
for (let second = 0; second < durationSeconds; second++) {
|
||||
for (let event = 0; event < users * editsPerUserPerSecond; event++) {
|
||||
for (let recipient = 0; recipient < users; recipient++) {
|
||||
fanouts++;
|
||||
if (lastCheckSecond[recipient] !== second) {
|
||||
checks[recipient]++;
|
||||
lastCheckSecond[recipient] = second;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const optimized = checks.reduce((a,b) => a+b, 0);
|
||||
const baseline = fanouts;
|
||||
assert.equal(optimized, users * durationSeconds);
|
||||
assert.ok(optimized <= baseline);
|
||||
console.log(`${users} clients | ${fanouts.toLocaleString('en-US')} broadcast deliveries | auth reads: ${baseline.toLocaleString('en-US')} -> ${optimized.toLocaleString('en-US')} | reduction ${(100*(1-optimized/baseline)).toFixed(2)}% | simulation ${(performance.now()-start).toFixed(1)} ms`);
|
||||
}
|
||||
@@ -51,3 +51,11 @@ html = renderMarkdown('Hello @a[1]\\x and @<f>&" but not @a[1]\\xy');
|
||||
assert.equal((html.match(/class="markdown-mention"/g)||[]).length, 2, 'escaped nicknames');
|
||||
assert.doesNotMatch(html, /<f>/, 'no raw HTML from nickname');
|
||||
console.log('PASS: special-character nicknames remain escaped');
|
||||
|
||||
html = renderMarkdown('- [ ] Open\n- [x] Done\n- [~] Cancelled\n - [~] Nested cancelled');
|
||||
has(/task-list-item--cancelled/, html, 'cancelled task has its own class');
|
||||
assert.equal((html.match(/task-list-item--cancelled/g) || []).length, 2, 'both cancelled tasks recognized');
|
||||
has(/data-source-line="3" disabled aria-label="Cancelled task"/, html, 'cancelled checkbox cannot be clicked');
|
||||
has(/data-source-prefix="- \[~\] "/, html, 'cancelled markdown marker preserved');
|
||||
has(/data-source-line="1"(?! disabled)/, html, 'open task remains interactive');
|
||||
console.log('PASS: cancelled tasks are disabled and retain their source markers');
|
||||
Reference in new issue
Block a user