Skip to content

Further thoughts on performance improvements #418

Description

@TurpentineDistillery

My analysis of the performance bottlenecks showed that passthrough (non-instantiating) parsing performance is comparable to that of wc (i.e. near-perfect), and the major bottleneck is the usual bane of performant programming - mallocs and frees of many small objects. Can this be improved without resorting to custom allocators game? I think so. The performance becomes an issue when there are many json records to parse. In real-world scenarios the records will have the same schema - just the values that are different. Under this assumption, if we have an old json object that is no longer needed, it can be reused to update the values within, rather than let it expire, freeing the contents, and then allocate everything de-novo in a new json. This would entail having a function like json::parse(istream& istr, json& dest) that would take an existing record and reuse the existing fields where possible, making allocations only when necessary (longer strings, longer arrays, keys in maps that are absent in the old object, etc).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions