feat: add web-worker-perf variant to libavoid-standalone demo#19
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…add README Move the 5-node demo graph into src/shared/example-graph.js so ui-thread and web-worker variants differ only in where the router runs. Document all three variants in js/README.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
web-worker-perfvariant to the libavoid demo and tightens the existingweb-workervariant.New perf variant (
src/web-worker-perf/)console.time('worker routed').Web-worker variant improvements
src/shared/example-graph.js, so the two apps are apples-to-apples — the only substantive difference is where the router runs. The previousweb-worker/example.jsonis deleted.awaiting-updatehighlighter expanded to cover every pending-route state: initial load, element move/resize, new link drawn, endpoint dragged off a port. Removed per-link onroutedreplies (previously used a blanketremoveAll).routedreply to a link the user has since disconnected locally (prevents a snap-back race).markAwaiting/unmarkAwaitingtosrc/shared/awaiting.js.Build / tooling
USE_WEB_WORKERS=1→VARIANT=<folder>.package.jsonkeepsstart-web-worker/build-web-workerworking and adds matching*-web-worker-perfscripts;webpack.config.jsreadsprocess.env.VARIANT.AvoidRouter.onGraphReset(previousModels = [])defaults to an empty array so the perf variant's reset-from-empty flow doesn't throw.styles.scss: scoped.joint-paperborder to.ui-thread, extended.web-workerrules to cover.web-worker-perf, added a fixed-position.diagram-selectordropdown style.Docs
js/README.mdgains a Variants section documenting all three variants with their purpose and run commands.Lint (pre-existing on
main, bundled here to unblock CI)microservices-architecture/ts/src/*.ts: 68 issues auto-fixed (object-curly-spacing,@typescript-eslint/consistent-type-imports).microservices-architecture/ts/src/link-routing.ts: replaced(target as any)[prop]withReflect.get(target, prop)— idiomatic for a Proxygettrap, noanycast.Test plan
cd libavoid-standalone-link-routing/js && npm installnpm start— ui-thread still loads and routes the shared 5-node graphnpm run start-web-worker— web-worker loads with the newVARIANT=web-workerenv var; same graph routes through the worker; moving an element showsawaiting-updateon connected links; creating a new link / dragging an endpoint off a port also flips the visualnpm run start-web-worker-perf— perf demo loads; selector switches between Diagram 1 and Diagram 2; drag on blank rubber-band zooms; click on blank or on a cell fits the papernpm run lintat the repo root finishes clean🤖 Generated with Claude Code