manuelluis / jsrrdgraph

javascript rrdgraph
61 stars 12 forks source link

Performance fix for graphs in the future #15

Closed Lekensteyn closed 9 years ago

Lekensteyn commented 9 years ago

For a RRD file with a minimal step size of 1, all values past the last update time would be calculated individually with a step size of 1. That is kind of a waste since the result is always NaN.

This patch handles that case specially, significantly reducing the number of calculations (and thus the running time). There is still an expensive calculation at the transition from the end to NaNs, but that is probably unavoidable unless the step matching gets improved.

The test was done against a RRD graph covering a time span of 1 day (86400 seconds).

manuelluis commented 9 years ago

Thank you.