Skip to content

Future: differential outbox updates to reduce bandwidth beyond VALUE_PROP#128

Draft
evnchn wants to merge 3 commits intomainfrom
outbox-simplification
Draft

Future: differential outbox updates to reduce bandwidth beyond VALUE_PROP#128
evnchn wants to merge 3 commits intomainfrom
outbox-simplification

Conversation

@evnchn
Copy link
Copy Markdown
Owner

@evnchn evnchn commented Apr 3, 2026

Tracking PR — do not merge

This tracks the broader bandwidth optimization idea from zauberzeug#5728: sending only changed attributes in outbox updates, not just skipping VALUE_PROP.

Why keep this

The bool-flag approach (zauberzeug#5933) only skips echoing VALUE_PROP back to the client. The original diff machinery from this branch could reduce bandwidth further by omitting all unchanged props, classes, styles, etc. For elements with large prop dicts (ag_grid with thousands of rows, plotly, table), this could be significant.

What blocked it

@falkoschindler's review identified:

  • Performance risk: deepcopy on every element per outbox tick is expensive on hot paths
  • Reconnection correctness: diffs in message_history could produce stale state on socket-only reconnect
  • Falsy-key edge case: empty strings disappear from _to_dict, causing stale values on client

Path forward

If bandwidth becomes a bottleneck again:

  1. Benchmark deepcopy vs json.loads(json.dumps()) on heavy elements
  2. Consider copy-on-diff (only copy when something changed)
  3. Ensure build_response and try_rewind always use full state
  4. Handle falsy-key edge case in _to_dict

The original implementation is preserved on the outbox-simplification branch for reference.

evnchn and others added 3 commits February 6, 2026 09:33
- Track last-sent state per element to compute diffs
- Send only changed properties instead of full element state
- Add client-side deep merge for incoming diffs
- Optimize LOOPBACK=False elements to avoid redundant updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@evnchn evnchn added the revive:client-1to1 Revive if NiceGUI commits to 1:1 Client↔browser-client mapping label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

revive:client-1to1 Revive if NiceGUI commits to 1:1 Client↔browser-client mapping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant