jimhigson / oboe.js

A streaming approach to JSON. Oboe.js speeds up web applications by providing parsed objects before the response completes.
http://oboejs.com
Other
4.78k stars 208 forks source link

Performance improvement needed, too slow for large data #206

Open hoogw opened 4 years ago

hoogw commented 4 years ago

Performance improvement needed.

I test 60K (350MB) json file, oboe, compare to browser native stream api is 10 times slower.

Only for small amount of data, difference is trivals.

Oboe, must have some over head over xhr.

If you use browser native stream api replace current xhr,

would it greatly improve the performance?

Now, for large data, I can't use oboe, it is way too slow. Instead, I just use browser native stream api , write simple parser on my own.

hoogw commented 4 years ago

I guess, not verified, the slowness of oboe, is caused by blob, Blob/FileReader , blob builder etc....

To make it fast, need to use var string = new TextDecoder(encoding).decode(uint8array);

there are several article talking about this slowness:

https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String

https://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers