As far as I can tell, the only purpose these lines serve is to confirm that predictedLiveBytes is valid JSON. But at this point in the code, I don't think we have any reason to believe that the JSON is not valid. We're relying on solid libraries to produce that JSON. Even if the JSON were somehow invalid, I'm not sure there's any value in validating it here versus where it's eventually used.
As far as I can tell, the only purpose these lines serve is to confirm that
predictedLiveBytes
is valid JSON. But at this point in the code, I don't think we have any reason to believe that the JSON is not valid. We're relying on solid libraries to produce that JSON. Even if the JSON were somehow invalid, I'm not sure there's any value in validating it here versus where it's eventually used.Here's the benchmark output:
It's a small but not insignificant memory and compute win. I think the benefits increase as the JSON size increases.
And the benchmark code: