Adopting simdjson for JSON::XS?

Peter Juhasz peter.juhasz at comnica.com
Mon Jun 12 15:57:59 CEST 2023


On Sat, 2023-06-10 at 16:53 +0200, Marc Lehmann wrote:
> On Sun, Mar 19, 2023 at 07:58:15PM +0100, Peter Juhasz
> <peter.juhasz at comnica.com> wrote:
> > would you be interested in a patch that adds the simdjson library
> > as an
> > alternative decoder to JSON::XS?
> 
> Hi, and sorry for the late reply - my fault.
> 
> Currently, JSON::XS has one of the best parsers there is in terms of
> correctness, and I don't think it makes sense to replace it by
> something
> of unknown quality that isn't compatible, and is far less portable
> (C++),
> with all the associated build problems that c++ brings.
> 
> I think it would make most sense to have another module using
> simdjson, e.g.
> JSON::SIMD or something along that lines.

Hi, 

in the meantime I've decided to proceed with the fork and released it
as JSON::SIMD, mostly for the reasons you cite (freedom of choice,
limited portability), but also because with a new module the new parser
could be enabled as default, and new functionality could be added.

By the way, I wouldn't call the simdjson parser "of unknown quality",
it's widely deployed and has a comprehensive test suite.


[...]

> 
> > Perhaps it would be better to decode
> > floating point numbers that don't fit into a double as strings,
> 
> The problem is detetcing those cases reliably - there is also the
> option
> of Math::BigFloat.
> 

Detecting those cases shouldn't be that hard - the range of IEEE 754
doubles is well defined after all. Using Math::BigFloat would have been
a severe break of compatibility (even with a new option, like in
Cpanel::JSON::XS), I did not want to open that can of worms.

best regards,
Peter Juhasz




More information about the perl mailing list