3 ms·
Padding is better and does solve many things, but it's still in the file. That external header/metadata nio.nim approach allows you to separate concerns like s
by cb321 2y ago
Padding is better and does solve many things, but it's still in the file. That external header/metadata nio.nim approach allows you to separate concerns like slicing rows and columns (for 2D anyway) in a shell pipeline. This is nice if you want to do relational database like things but with a db that is fully in binary, avoiding ascii -> bin (parse) and even more costly bin -> ascii (print) cycles. The mental model is closer to "text-workflow", though.
To follow up on the general thought, another thing padding can help with that you/the article don't mention might be "many time series in a matrix format". In one index order, you can just add a row, but in the transposed index order, you need to widen a matrix. To avoid a full re-write you can instead just pad with NA. Still O(nObjs) tiny updates to flush to disk which could even be many 4k page writes, but for long time series it can still be more efficient. https://github.com/c-blake/nio/blob/ffb671ce23b1b77899c3bcff7da2f1ebfb53e7d2/nio.nim#L1804 https://github.com/c-blake/nio/blob/ffb671ce23b1b77899c3bcff... has a `proc upstacks` command to do this and https://github.com/c-blake/nio/tree/main/demo/timeSeries https://github.com/c-blake/nio/tree/main/demo/timeSeries a fully worked example.