Virtual-X
Virtual-X
Certainly. I'd say the biggest risk with a complete rewrite is the behaviour for untested cases, maybe some users are even relying on the current behaviour for malformed jsons? There...
RegExp is not that good, or just Chrome is very fast iterating strings. Here are measures for the 26 MB string: ``` const len = json.length; let i = 0,...
``` var tokenizer = /["\n\r]|(?:\/\*)|(?:\*\/)|(?:\/\/)/g, tmp, lc, rc; while (tmp = tokenizer.exec(json)); ``` time 184 ms = 142460 chars/ms ``` var tokenizer = /["\n\r]|(?:\/\*)|(?:\*\/)|(?:\/\/)/g, tmp, lc, rc; while (tmp =...
It was straight-forward to port my code to c++ and c, see https://github.com/Virtual-X/JSON.minify/tree/cpp 2. https://github.com/json-iterator/test-data/blob/master/large-file.json source length 26141343, minified length 26129992 js upstream time 1164 ms = 22454 chars/ms js...