jimhigson / oboe.js

A streaming approach to JSON. Oboe.js speeds up web applications by providing parsed objects before the response completes.
http://jimhigson.github.io/oboe.js-website/index.html
Other
4.79k stars 208 forks source link

JSONTestSuite test results #171

Open l1bbcsg opened 6 years ago

l1bbcsg commented 6 years ago

There's this Parsing JSON is a Minefield article which details various issues (mostly in edge cases) across different JSON parsers.

Its author produced a test suit to test various implementations. I've run this test suit against Oboe (on node 9.6.1), results compared to native JSON.parse are below (successful tests not shown).

Generally, I think the results are good. But there's one thing that Oboe does different from native implementation (and others): It allows some malformed inputs slide where JSON.parse does not.

I'm raising this issue more for the purposes of discussion. What do you think, should this be addressed?

Results screenshot

Image

Legend

image

Snippet I used to run Oboe (derived from their JSON.parse):

var fs = require('fs');
var path = process.argv[2];
var oboe = require('oboe');

try {
    var stream = fs.createReadStream(path);
    oboe(stream).fail(function(e) {
        if (e.thrown)
            throw e.thrown;
    });
} catch (e) {
    console.log("--", e.message)
    process.exit(1);
}

process.exit(0);

Note that at the time of writing the test runner has a really weird bug preventing it from running which isn't hard to patch out though.

I'm a bit confused on relationship between Oboe and Clarinet, website states Oboe is based on Clarinet, but I don't see it as a dependancy and the test results of Oboe are somewhat different from Clarinet. If you do have any interest in Clarinet, I opened a similar issues there: https://github.com/dscape/clarinet/issues/49.