Skip to content

perf: compact initial TailHTML fixups - #388

Merged
linkdata merged 7 commits into
mainfrom
perf/compact-tail-script
Aug 25, 2026
Merged

perf: compact initial TailHTML fixups#388
linkdata merged 7 commits into
mainfrom
perf/compact-tail-script

Conversation

@linkdata

@linkdata linkdata commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Closes #387

Summary

  • emit one block-scoped fixup wrapper and only the A/R/C/D helpers used by each initial tail
  • pass numeric Jid suffixes and reconstruct element IDs from jid.Prefix
  • preserve raw operation payloads; only SAttr splits at its first newline
  • isolate each operation, preserve missing-element and escaping behavior, and apply the WebSocket client's reserved-id guard
  • preallocate from eligible operation, helper, and payload sizes
  • serve the generated classic script explicitly as UTF-8
  • cover helper selection and alias mapping without Node, and compare DOM effects and errors with the WebSocket dispatcher when Node is available

All non-empty tails use the alias form. One SClass("cls") fixup grows from 89 to 146 bytes; six comparable class fixups shrink from 534 to 201 bytes.

Measurements

Compared with origin/main using six one-second samples per version and benchstat. The timed loop includes queue refill and one-shot reset.

Fixture Tail bytes Time/op B/op Allocs/op
One fixup 89 → 146 (+64.0%) 193.6 → 155.6 ns (-19.7%) 224 → 160 (-28.6%) 3 → 1 (-66.7%)
300-operation board 32,120 → 9,196 (-71.4%) 108.19 → 40.23 µs (-62.8%) 154,336 → 10,240 (-93.4%) 18 → 1 (-94.4%)
100 long attributes 21,792 → 14,419 (-33.8%) 119.65 → 70.78 µs (-40.8%) 113,376 → 16,384 (-85.6%) 17 → 1 (-94.1%)

Verification

  • go generate ./...
  • go vet ./...
  • gofmt -l .
  • staticcheck ./...
  • golangci-lint run
  • gosec ./...
  • go build ./...
  • GOOS=linux GOARCH=386 CGO_ENABLED=0 go build ./...
  • JAWS_REQUIRE_NODE=1 go test -race ./...
  • JAWS_REQUIRE_NODE=1 go test ./...

Emit block-scoped DOM helpers once per non-empty tail and pass numeric Jids with raw operation payloads. Preserve TailHTML lifecycle behavior while matching the WebSocket DOM operations and fixing newline handling for remove/class messages.
@linkdata
linkdata merged commit 1a65186 into main Aug 25, 2026
7 checks passed
@linkdata
linkdata deleted the perf/compact-tail-script branch August 25, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TailHTML: batch initial DOM fixups through the client dispatcher

1 participant