hyper-react icon indicating copy to clipboard operation
hyper-react copied to clipboard

render performance, should_component_update?

Open janbiedermann opened this issue 6 years ago • 0 comments

A reason for slow and repeated rendering is, that should_component_update? when checking if params are updated may always lead true. This is due to limitations of javascript. It is recommended to use simple data types as params for best performance, strings, numbers to avoid this effect.

The use of blocks or javascript functions or anything else that cannot be represented or compared reasonably by opals ruby types should be avoided. Comparing props with these types will always lead true for should_component_update? and cause a render.

This should also be considered when overwriting should_component_update?(next_props_hash, next_state_hash), its best to work with simple data types.

janbiedermann avatar Jan 27 '18 05:01 janbiedermann