IMO this is not necessary at this stage... this is currently super fast and is only used when first rendering the graphing page. We can still cache/optimize it later if necessary.