Skip to content

Test setup instantiates a new parser for every file #2

@daKmoR

Description

@daKmoR

I think many parsers are built so they can parse multiple html files one after another while using the same instance.

I assume you will get fastly different numbers if you rewrite this https://github.com/victornpb/benchmark-html-parser-libraries/blob/master/tests/sax.js

const sax = require("sax");

module.exports = function (html) {
	return new Promise((resolve, reject) => {
		const parser = sax.parser(false);

		parser.onend = resolve;
		parser.onerror = reject;
		parser.write(html);
		parser.close();
	});
};

to something like this

const sax = require("sax");
const parser = sax.parser(false);

module.exports = function (html) {
	return new Promise((resolve, reject) => {
		parser.onend = resolve;
		parser.onerror = reject;
		parser.write(html);
		parser.close();
	});
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions