Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize input reading and output writing
This commit aims to fix issue #20. Use the Emscripten FS.writeFile API for accepting XML input files, instead of the createDataFile and especially the intArrayFromString function. Those were inherited from the parent upstream project, but this writeFile API seems to be simpler to use and performs better. The bigger fix, though, is in the output side, as pushing one piece of stdout (I guess it was pushing one byte at a time?) caused the stdoutBuffer array to eventually grow so large that it'd throw > RangeError [Error]: Invalid array length when the output was very big, like when normalizing a big input XML, as described in #20. Here, too, we can switch to the print/printErr APIs, which seem to be not only simpler but also more resilient to the input size growing.
- Loading branch information