JSON中的时间序列数据

Ali*_*ehi 5 javascript streaming json time-series

我需要在JSON中建模1,000,000多个数据点.我在想两种方法:

a)对象数组:

[{time:123456789,value:1432423},{time:123456790,value:1432424},....]
Run Code Online (Sandbox Code Playgroud)

要么

b)嵌套数组

[[123456789,1432423],[123456790,1432424],....]
Run Code Online (Sandbox Code Playgroud)

天真地比较这两种方法,感觉后者更快,因为它使用更少的字符,但描述性较差.b真的比一个快吗?你会选择哪一个?为什么?

有第三种方法吗?

hel*_*bye 8

{time:[123456789,123456790,...], value:[1432423,1432424,...]}
Run Code Online (Sandbox Code Playgroud)

为什么?

  1. 迭代原始数组更快.
  2. 与b)的"JSON大小"相当,但您不会丢失"列"信息

这个npm可能很有趣:https://github.com/michaelwittig/fliptable