graphql-jit icon indicating copy to clipboard operation
graphql-jit copied to clipboard

Consider using slow-json-stringify

Open stephenh opened this issue 4 years ago • 4 comments

I came across slow-json-stringify recently (via just-js using it, plus a lot of other optimizations, to get a high ranking on benchmarks), which has ~generally ~150-200% faster benchmarks over fast-json-stringify:

https://github.com/lucagez/slow-json-stringify/blob/master/benchmark.md

It requires the same setup as fast-json-stringify, of providing it a schema, albeit its own bespoke schema instead of a json schema.

But seems like this would be useful to try.

stephenh avatar Feb 12 '21 04:02 stephenh

I think a better way moving forward is to have this as a separate package. To do so, we would need an API to allow custom stringify integration, which I am trying to achieve here: https://github.com/zalando-incubator/graphql-jit/pull/88

hoangvvo avatar Mar 07 '21 04:03 hoangvvo

@hoangvvo do you have plans to develop PR? Or is there something I can help you with?

negezor avatar Nov 15 '21 10:11 negezor

@hoangvvo do you have plans to develop PR? Or is there something I can help you with?

@negezor Thanks for the offer. I actually already have the PR merged to my fork at https://github.com/hoangvvo/graphql-jit.

Creating the PR should be trivial. It matters more whether there would an intent to merge it into this project (since it is possible that this is not their use cases or the current fast-json-stringify implementation is being used by some people)

hoangvvo avatar Nov 15 '21 10:11 hoangvvo

@hoangvvo do you have any numbers about how much faster slow-json-stringify was specifically for your project or on a graphql-jit benchmark?

Just thinking that, per your wondering if a PR for graphql-jit would be accepted, that having graphql-jit-specific benchmarks showing what a specific increase was, would hopefully pique the interest of the maintainers.

stephenh avatar Nov 16 '21 15:11 stephenh