HipJSON: A high performance implementation of JSON parser with std.json syntax. Used by Redub and Hipreme Engine
Hipreme
msnmancini at hotmail.com
Thu Oct 30 23:23:40 UTC 2025
On Thursday, 30 October 2025 at 16:40:54 UTC, Dennis wrote:
> On Thursday, 30 October 2025 at 13:02:16 UTC, Hipreme wrote:
>> Redub uses a cache system in which the hash of an object
>> becomes a key. This does not translate well to structs as they
>> are "random" keys. (...)
>
> So you have several use cases where the keys are not a small
> set known ahead of time, but constructed dynamically. Makes
> sense, though now I wonder why you would use JSON for your
> cache or filesystem when performance is such a concern. Or when
> it's not a concern, why std.json doesn't suffice.
>
>> There is another case in which the dynamic type API is kinda
>> important, which is mostly when you do union types, so one
>> would still need a good representation of it:
>
> You could define:
>
> ```D
> struct Input
> {
> string keyboard;
> string gamepad;
> string analog;
> string axis;
> }
> ```
>
> And then check the length of those strings to see if they have
> a value.
>
> Either way, it's still useful to have a fast JSON parser using
> dynamic objects, and using std.json's API makes it an easy
> upgrade.
I do plan to also add a streaming API in the near future. I think
that with this addition, it will also becomes a lot easier to add
this new struct dump API.
Btw, with HipJSON, I can parse up to 700MBps for my cache system.
Considering it usually takes like 120KB, it becomes like 0.17ms
to parse that cache, so I don't think it is slow. THe 80MBps I
show there is for parsing pure-dictionary, which is the slowest
operation you can do for JSON.
More information about the Digitalmars-d-announce
mailing list