react-textarea-autosize icon indicating copy to clipboard operation
react-textarea-autosize copied to clipboard

Why IS the performance so poor?

Open YCMitch opened this issue 5 years ago • 3 comments

I've moved to using this component instead of the other one, as the other inexplicably stops all transitions from CSSTransitionGroup and the like.

As I've seen reported on here already, when there's a lot of components in use, it's real janky and lags a fair bit - far more than I'd expect from simply doing some calculations involving font sizes and line-heights and whatnot.

I'm not here to complain, but as I've seen a mention of adding an ID increases performance for some reason, are there any other undocumented things we should know about that could smoothen things out a little?

YCMitch avatar Feb 27 '19 06:02 YCMitch

You can use useCacheForDOMMeasurements prop if your styles are static.

I'd love to work on improving performance if possible, but personally I don't see any junk. Could you record a movie/gif demonstrating the problem? A profiler dump which I could load would also be helpful.

Andarist avatar Feb 27 '19 08:02 Andarist

I see same issue also with useCacheForDOMMeasurements. screenshot 2019-02-28 at 16 28 56

seeden avatar Feb 28 '19 15:02 seeden

According to this screenshot componentDidUpdate of react-textarea-autosize fires 11x in a single stack frame. Seems like it's possible that u call setState in onHeightChange callback and you are causing a synchronous rerender - for some reason your component can't "settle" for a while.

Hard to be sure without seeing the repro case though.

Andarist avatar Feb 28 '19 17:02 Andarist