Skip to content

Skip JSON.parse for plain hx-live data - #4209

Draft
scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/hx-live-skip-plain-json
Draft

scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/hx-live-skip-plain-json

Conversation

@scriptogre

@scriptogre scriptogre commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

data.* reads now skip JSON.parse for values that cannot be JSON, so plain text reads faster.

<div data-state="idle">
  <span :text="data.state"></span>
</div>
data-* value Before After
idle JSON.parse throws, returns "idle" returns "idle"
42 JSON.parse, returns 42 same
{"a":1} JSON.parse, returns the object same

Every value reads the same as before.

1,000 plain reads per recompute: 5.2 ms before, 0.6 ms after.

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.

1 participant