Fast XML Parser vs @nodable/flexible-xml-parser
This is equivalent to running fast-xml-parser with preserveOrder mode false. Parser produces compact JS output. In this case fast-xml-parser goes through 2 layers of processing. But Flexible XML Parser gives the opportunity to write direct output builder for any format.
| ptest | ptest_with_prolog | sample | |
|---|---|---|---|
| fast-xml-parser | 19721.54801 | 20030.72751 | 19731.82809 |
| @nodable/flexible-xml-parser | 33500.48755 | 32858.31683 | 33274.53886 |
| Total | 1.69867434 | 1.640395578 | 1.686338372 |
All the values in the table shows requests per second
This is equivalent to running fast-xml-parser with preserveOrder mode true. Parser produces JS array.
| ptest | ptest_with_prolog | sample | |
|---|---|---|---|
| fast-xml-parser (preserveOrder) | 24482.78044 | 21866.79117 | 7986.529038 |
| @nodable/flexible-xml-parser | 30151.67155 | 26204.83804 | 11267.0917 |
| Total | 1.23154605 | 1.19838516 | 1.410762003 |
All the values in the table shows requests per second
This test includes reading file, parsing, writing the output to file.Fast XML parser doesn't support streams directly so it reads synchronously. Flexible XML Parser using stream reader and stream writer (output builder).
| 1.5 KB | 13 MB | 98 MB | |
|---|---|---|---|
| fast-xml-parser (preserveOrder) | 2534.349036 | 0.77777445 | 0.096257164 |
| @nodable/flexible-xml-parser (using streams) | 4176.031814 | 0.475603819 | 0.016075023 |
| Total | 1.647772961 | 0.61149324 | 0.167000801 |
All the values in the table shows requests per second
Though, the performance of Flexible XML Parser is degrading with increasing file size but there is a clear advantage in memory.
All the values in the table are in MBs.
| heap used | heap total | RSS | |
|---|---|---|---|
| before FXP | 5.11 | 9.78 | 53.39 |
| after FXP | 5.41 | 10.28 | 54.39 |
| before Flexible | 5.4 | 10.53 | 54.39 |
| after Flexible | 5.66 | 11.03 | 54.64 |
All the values in the table are in MBs.
| heap used | heap total | RSS | |
|---|---|---|---|
| before FXP | 5.11 | 9.78 | 54.02 |
| after FXP | 127.45 | 164.28 | 230.75 |
| before Flexible | 5.49 | 38.28 | 208.07 |
| after Flexible | 18.18 | 52.49 | 223.09 |
All the values in the table are in MBs.
| heap used | heap total | RSS | |
|---|---|---|---|
| before FXP | 5.11 | 10.03 | 53.57 |
| after FXP | 920.21 | 968.91 | 1019.68 |
| before Flexible | 5.48 | 38.53 | 848.61 |
| after Flexible | 102.31 | 144.2 | 948.99 |
