signalapp / Signal-iOS

A private messenger for iOS.
https://signal.org
GNU Affero General Public License v3.0
10.8k stars 3.03k forks source link

Slow typing, delayed local-echo, while searching contacts/groups on compose screen #2884

Closed gsbabil closed 5 years ago

gsbabil commented 6 years ago

Bug description

Steps to reproduce

  1. Install GBoard from App Store

  2. Proceed to write a new message for the first time to a contact (navigate to the "New Message" screen by tapping the top-right icon from Signal's Inbox screen)

  3. Type part of the contact's name in the contact-list search-bar with GBoard.

Actual result:

Expected result:

Device info

Link to debug log

Screenshots

img_1827

ThuggishNuggets commented 6 years ago

Haven't dug into the code just yet, but the way this behavior presents makes me think there's some work happening on the foreground/main thread in response to the search text changing that should instead be dispatched to a background/global thread.

ThuggishNuggets commented 6 years ago

Yeah, assuming this is the correct file, all of this code is run on the main thread in response to changes to the UISearchBar's text changing, which is quite a lot.

Might be a good idea to change -updateSearchPhoneNumbers to accept a completion handler and dispatch_async the work in its body to another dispatch_queue then have it call the completion handler when it's finished.

Will work on these modifications once I get the project building on this machine (it seems the High Sierra install broke some of my tools).

gsbabil commented 6 years ago
    - Device         : iPhone 6
    - iOS version    : 11.3.1 (15E216)
    - Signal version : 2.23.4.2
michaelkirk-signal commented 6 years ago

Your keyboard is unlikely to be the cause here, we're simply not doing a performant job of searching.

If someone wants to fire up their profiler, there's probably some low hanging fruit in the search indexing/machinery.

Caching the search index would probably be a good start.

michaelkirk-signal commented 5 years ago

Keyboard input should no longer be sluggish on this screen.