Skip to content

Performance: Pointer Encode / Decode #73

@amiller-gh

Description

@amiller-gh

Pointer encode and decode are relatively expensive operations called on a very hot code path. By only running the regex replaces when required we can see ~2x perf gains for large diffs.

Current state of the world:

image

With token escaping completely disabled:

image

This is close to being on par with fast-json-patch.

Unfortunately, an indexOf check before running the regex replaces does not help matters. It may be possible to instead track characters as pointers are constructed to decide if encode / decode should be run. I haven't had time to experiment with this, but plan to in the near future.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions