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:

With token escaping completely disabled:

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.
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:
With token escaping completely disabled:
This is close to being on par with
fast-json-patch.Unfortunately, an
indexOfcheck 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.