Skip to content

improve hx-live perf by skipping no change updates#3891

Merged
1cg merged 3 commits into
bigskysoftware:four-devfrom
MichaelWest22:hx-live-perf
Jul 13, 2026
Merged

improve hx-live perf by skipping no change updates#3891
1cg merged 3 commits into
bigskysoftware:four-devfrom
MichaelWest22:hx-live-perf

Conversation

@MichaelWest22

Copy link
Copy Markdown
Collaborator

Description

We can improve hx-live performance so we can support maybe 1000 live bindings on a page by guarding writes that don't change anything so it avoids wasted time updating the dom with no changes. This gives a 2-3x speed increase

Also added a possible 100ms debounce for input events so typing into an input does not overload the live tasks at the cost of slowing down the updates from typing. change and dom mutations fire instantly still.

Corresponding issue:

Testing

Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

Comment thread src/ext/hx-live.js Outdated
document.addEventListener('input', () => {
clearTimeout(inputDebounceId);
inputDebounceId = setTimeout(schedule, INPUT_DEBOUNCE_MS);
}, true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this listener be captured and removed in deactivate() like the recomputeBound listener is?

@1cg

1cg commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Thank you!

@1cg 1cg merged commit 52beadd into bigskysoftware:four-dev Jul 13, 2026
3 checks passed
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.

2 participants