status-im / status-mobile

a free (libre) open source, mobile OS for Ethereum
https://status.app
Mozilla Public License 2.0
3.85k stars 984 forks source link

New composer typing latency #15883

Open ilmotta opened 1 year ago

ilmotta commented 1 year ago

Problem

The new composer brought many good improvements, but typing in it has so much latency that it became barely usable on an Android emulator, but before, in the old composer, it was quite smooth.

Even if the performance is good on a real device, it seems the new code is causing heavy re-rendering in some parts of the tree.

What do we expect

It doesn't have to be as fast as before perhaps, but it seems prudent to investigate what are we doing that's causing such slowdown in input latency.

OmarBasem commented 1 year ago

Thanks @ilmotta for opening the issue.

@ulisesmac feel free to look into the issue.

qfrank commented 1 year ago

If it’s because mention, i got a pr for optimization, I’ll push it in 1 hour @ilmotta @ulisesmac

ilmotta commented 1 year ago

That could definitely help @qfrank, but I don't think it's the main reason because in the previous composer mentions were already used as they're now. But in any case, nice to see you're coming with optimizations! Awesome!

ilmotta commented 1 year ago

I'm closing this issue because I talked to @flexsurfer and he said he already looked into the new composer performance and there are no low-hanging fruits to pick and it seems other users & devs are not reporting performance issues so far.

flexsurfer commented 1 year ago

i didn't consider hooks, now we have to find a way how to profile hooks and effects/animations performance

flexsurfer commented 1 year ago
 ERROR  Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    in status_im2.contexts.chat.composer.view.sheet_component

might be related

ilmotta commented 1 year ago

i didn't consider hooks, now we have to find a way how to profile hooks and effects/animations performance

@flexsurfer Just curious, are you planning on improving re-frisk in some way to take hooks into account?

flexsurfer commented 1 year ago

Just curious, are you planning on improving re-frisk in some way to take hooks into account?

Unfortunately no, re-frisk works only with re-frame, it doesn't know anything about hooks :(

flexsurfer commented 1 year ago

so just regular js profiler should be used