Hello,
We recently found out that the React.checkPropTypes was taking about 8-10% of the CPU when rendering "massive" amount of object (~1200).
We are wondering if there is a way to somehow improve the perfs and disable the checkPropTypes for instance.
After all, those are mainly useful in development mode, not much in production.
(I'm just thinking right now that it may already be disabled if NODE_ENV is set to 'prod', but that's unlikely)
Thanks.
@Vadorequest I'm pretty sure that prop types checking are disabled once NODE_ENV=production and that is the same for all sanity checks. Pay attention to use the production bundle of React.js (depending on your workflow: Webpack, Browserify, whatever).
@Vadorequest You can see at ReactCompositeComponent.js#L669 that _checkPropTypes is only called when processing props if _DEV_ is true.
These should be disabled as others have said but if you can reproduce & share a case where they aren't, that would be helpful. And _just in case_ you weren't abbreviating in your comment, make sure you have NODE_ENV set to production not prod. I'm going to close out but we can reopen if need be.
Thanks guys for the fast&detailled answers! ;)
(Indeed, I abbreviated, I do use production and not prod)
Most helpful comment
@Vadorequest You can see at ReactCompositeComponent.js#L669 that
_checkPropTypesis only called when processingpropsif_DEV_is true.