Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: Pointer Encode / Decode #73

Open
amiller-gh opened this issue Aug 7, 2020 · 0 comments
Open

Performance: Pointer Encode / Decode #73

amiller-gh opened this issue Aug 7, 2020 · 0 comments
Assignees

Comments

@amiller-gh
Copy link

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.

@amiller-gh amiller-gh changed the title Performance: Performance: Pointer Encode / Decode Aug 7, 2020
@chbrown chbrown self-assigned this Sep 20, 2020
@chbrown chbrown pinned this issue Sep 20, 2020
@chbrown chbrown unpinned this issue Sep 20, 2020
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

No branches or pull requests

2 participants