OptimumCode/json-schema-validator

Enhancement: JsonPointer performance improvements

Closed this issue · 0 comments

Is there an existing issue for this?

  • I have searched the existing issues

Enhancement description

In the current version, JsonPointer uses a lot of string concatenations (with StringBuilder) and parsing following those concatenations. As a result significant amount of time spent on those operations.

This can be changed if the way JsonPointer stores the path is updated. Right now it holds the whole path string and different segments use their offset in that path. It helps to improve toString and hashCode operations, however, it negatively impacts other operations. To reduce this impact JsonPointer should not store the path string and should compute it based on the segments it has. To keep performance for toString and hashCode methods on a normal level those values should be cached