raml-js-parser-2 icon indicating copy to clipboard operation
raml-js-parser-2 copied to clipboard

Very slow performance of parseRAMLSync and toJSON methods

Open glodieu opened this issue 8 years ago • 5 comments

Parsing the given RAML data using the following lines both methods takes around 30 seconds each.

const parsedData = parser.parseRAMLSync(data, RAMLImporter._options(options)); //30 seconds
if (parsedData.name === 'Error') {
  reject(error);
} else {
  this.data = parsedData.expand(true).toJSON(toJSONOptions); //30 seconds
resolve();
}

glodieu avatar Feb 17 '17 22:02 glodieu

652.txt

glodieu avatar Feb 17 '17 22:02 glodieu

File has more than 19000 lines.

glodieu avatar Feb 17 '17 22:02 glodieu

Please check the new API https://github.com/raml-org/raml-js-parser-2/blob/master/documentation/GettingStartedNewApi.md and let us know if it helps, this one should be faster.

Note that we can not speed the parser up like 10 times.

ddenisenko avatar Oct 04 '17 09:10 ddenisenko

Hi @ddenisenko , I don't know what are the method of the new API for parseRAML. (old API) => (new API) loadApi => load loadApiSync => loadSync parseRAML => ??? parseRAMLSync => ???

Thanks.

glodieu avatar Oct 10 '17 16:10 glodieu

Note that raml-js-parser-2 has been deprecated, the new official parser is webapi-parser. Feel free to attempt to reproduce this issue with webapi-parser and report any issue you may have on that repository.

postatum avatar Sep 25 '19 09:09 postatum