Navigating certain lines of text with an external keyboard is very slow/laggy

Originator:lextar
Number:rdar://28461775 Date Originated:Sat, 24 Sep 2016 10:24:14 GMT
Status:Open Resolved:
Product:iOS Product Version:iOS 10.0.2 (14A456)
Classification:Performance Reproducible:Always
 
Area:
Keyboard

Summary:
In certain long lines of text, moving the cursor and changing the text selection with an external keyboard is very slow.

Steps to Reproduce:
1. Open the Notes app and add a new note
2. Paste the following line into the new note. The line is taken from a CSS file:

html{background:#fbfbfb 100%}body,a[rel]{color:#1b1b1b}body{font:100%/1.35'Iowan Old Style','Book Antiqua',serif;margin:0 auto;max-width:31em;padding:1em}a{text-decoration:none}a[rel=start]{background:url(http://apfwebs.com/apf.svg)left/1.6em no-repeat;padding:.62em 2em}div,nav{font-size:.85em}h1{font-size:1.25em;font-weight:normal;margin-top:.31em}nav{border-top:thin solid;padding-top:1em}

3. On an external bluetooth keyboard, use the cursor keys to navigate in this line

Expected Results:
There should be no lag when moving the cursor in this line.

Actual Results:
Cursor movement is very slow, even on an iPad Pro.

Version:
iOS 10.0.2 (14A456)

Notes:
This also happens in my own app that implements the UITextInput protocol and calls the -[UITextInputDelegate selectionDidChange:] method after changing the text selection using a custom text selection control.

Configuration:
iPad Pro 12.9" with external bluetooth keyboard

Comments

10-Apr-2017 04:00 PM

The issue is most pronounced when the keyboard language (in Settings -> General -> Keyboard -> Keyboards) is set to US English or German.

Setting the keyboard language to Dutch or Polish seems to improve the performance issues a lot.

09-Apr-2017 01:38 PM

The same problem also happens when using the keys on the on-screen keyboard to move the cursor (you get such keys for example in landscape mode on iPhone, see screenshot). It's not restricted to external keyboards, but it always seems to happen when the current cursor location/selection is changed.

'iPhone keyboard cursor keys.png' was successfully uploaded.

You can find a copy of the screenshot here: https://www.textasticapp.com/support/iPhone%20keyboard%20cursor%20keys.png

Additional Information 11-Jan-2017 08:03 PM

I could reproduce the problem using the Reminders app in the iOS Simulator.

Using the "Activity Monitor" instrument in Instruments, I now found out that a process called "kbd" is using almost 100% CPU when navigating one line text in the Reminders app with the Mac keyboard's arrow keys, while the Reminders process itself uses only 1% CPU.

I have attached a screenshot of Instruments next to the iOS Simulator that shows the kbd process using 99.5% CPU.

Please look into this bug, since it affects all apps and can be reproduced easily.

'Bildschirmfoto 2017-01-11 um 19.56.41 kbd process.png' was successfully uploaded.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!