Closed pixelzoom closed 1 year ago
I don't know how expensive these checks are.
My understanding of Property is that it always keep tracks of its initial value for Reset purposes, such that initialPoints would not be GC regardless of isValidValue
.
We can try to do some performance comparisons by eliminating altogether isValidValue
and go from there.
My understanding of Property is that it always keep tracks of its initial value for Reset purposes, such that initialPoints would not be GC regardless of
isValidValue
.
Ah, right you are. So nothing to do for that.
We can try to do some performance comparisons by eliminating altogether
isValidValue
and go from there.
In the State Wrapper console, I see ~900 ms to set state, with and without isValidValue
. (macOS 13.2.1 + Chrome 111) So there's no practical benefit to eliminiating the comparison of x-coordinates, and we should keep it in case a client violates #326.
Closing.
For https://github.com/phetsims/qa/issues/924 ...
In Curve.ts:
Two PhET-iO problems with the last line of code above:
(1)
initialPoints
will never be garbage collected, because it's included in the closure for theisValidValue
function. That means that 13,761 (11 x 1251) instances of CurvePoint will hang around forever.(2)
isValidPoints
compares every element inpoints
toinitialPoints
, to verify that they have the same x-coordinate. This seems like a potential performance problem. Perhaps this would be sufficient?@veillette thoughts?