A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
|
import { routeAll, type RouteInput } from '../app/lib/logic/routing'
|
|
|
|
|
|
|
|
|
|
it('routes 400 crowded wires fast enough to redraw while dragging', () => {
|
|
|
|
|
const inputs: RouteInput[] = []
|
|
|
|
|
const bodies = []
|
|
|
|
|
for (let i = 0; i < 400; i++) {
|
|
|
|
|
const col = i % 20
|
|
|
|
|
const row = Math.floor(i / 20)
|
|
|
|
|
// Sources in a column on the left, targets scattered: many wires want the same columns.
|
|
|
|
|
inputs.push({ id: `w${i}`, net: `n${i % 150}`, a: [col * 3, row * 3], b: [col * 3 + 8 + (i % 5), row * 3 + ((i * 7) % 11) - 5] })
|
|
|
|
|
if (i % 4 === 0) bodies.push({ x: col * 3 + 4, y: row * 3 - 1, w: 2, h: 2 })
|
|
|
|
|
}
|
2026-10-27 12:42:47 +00:00
|
|
|
// The best of three: other tests running at the same time can slow one run down.
|
|
|
|
|
let ms = Infinity
|
|
|
|
|
for (let k = 0; k < 3; k++) {
|
|
|
|
|
const t = performance.now()
|
|
|
|
|
routeAll(inputs, bodies, [])
|
|
|
|
|
ms = Math.min(ms, performance.now() - t)
|
|
|
|
|
}
|
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
|
|
|
console.log(`routeAll(400 wires): ${ms.toFixed(1)} ms`)
|
|
|
|
|
expect(ms).toBeLessThan(250)
|
|
|
|
|
})
|