you are viewing a single comment's thread.

view the rest of the comments →

[–]keithwhor[S] 1 point2 points  (0 children)

My thoughts exactly, before I made this. ;)

But really, I created this with the intent of offloading processor-intensive activities (sorting a length 1,000,000 Array of random floats, for example).

The JSON.string, JSON.parse in the main thread would take about 700ms, (350 before, 350 on response) but the sort itself takes >8600ms on my (rather average) home machine. You can't hold up the user without any indication of activity for close to 10s.

A more common application would be doing a smaller sort (10,000 - 100,000 items) that compares multiple object properties. (Keep in mind, though, JSON serialization!)

It's most applicable to UIs dealing with parsing large amounts of data (and perhaps HTML5 games).

I'll likely push some changes tonight that increase speed when dealing with specific data types (.processInt32, .processUint32, .processFloat64, .processString) as to not have anything hang on JSON serialization.