steveukx / properties

Properties reader for Node.js
MIT License
77 stars 33 forks source link

Parsing is substantially slower than I'd expect #36

Open nex3 opened 4 years ago

nex3 commented 4 years ago

When presented with properties files that contain thousands of entries, this package can take multiple seconds to parse them. This is substantially slower than a naive line-by-line parse method, and slow enough to make this package infeasible for my use-case.

See this benchmark, which compares properties-reader to a naive solution using string splitting. Here's the output I get:

.read() x 23.15 ops/sec ±1.05% (42 runs sampled)
naive x 2,600 ops/sec ±0.89% (98 runs sampled)
Fastest is naive

I might expect a naive solution to be a bit faster because it needs fewer checks for complex cases like comments and headings, but being two orders of magnitude faster is very surprising.

sdumjahn commented 4 years ago

I can confirm this behavior. We have files with about 12k lines and it needs more then 30seconds to read a single file.