getPropType has poor time complexity as it calls .toSource which serialises the entire Immutable data structure, and in some of the checkers this function is being unnecessarily called, even when no error has occured. As the data structure being checked grows large this can very noticeably slow down rendering (in development, at least). This PR moves calls to getPropType in the Record and Shape checkers so it is only called in an error case.
Ideally the implementation of getPropType wouldn't call .toSource but I couldn't easily come up with an alternative which works for all data structures, for all versions of immutable-js (something for another PR perhaps).
getPropType
has poor time complexity as it calls.toSource
which serialises the entire Immutable data structure, and in some of the checkers this function is being unnecessarily called, even when no error has occured. As the data structure being checked grows large this can very noticeably slow down rendering (in development, at least). This PR moves calls togetPropType
in the Record and Shape checkers so it is only called in an error case.Ideally the implementation of
getPropType
wouldn't call.toSource
but I couldn't easily come up with an alternative which works for all data structures, for all versions of immutable-js (something for another PR perhaps).