Laggy text input
I am using elementary OS Freya (Ubuntu 14.04) and experiencing laggy response times when typing text. It seems that the severity depends on amount the work uTox has to do.
Here too... I am using Ubuntu 12.04.
Happens on Gentoo too. qTox doesn't have this issue.
Edit: most visible when you tweak your keyboard settings a bit: $ xset r rate 220 200
Same problem here. Easy to reproduce...
Open up a chat with an online friend. Type and it isn't laggy. Exchange a bunch of messages and it gets worse, but still not too bad.
Now, maximize the window so it takes the full screen. Then copy and paste the following text into a message without newlines into utox and send 10 times on the linux client. (really long lines are slower than lots of short lines)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed mi dui. Maecenas ut mauris sit amet turpis tristique bibendum. Aenean imperdiet enim eget tincidunt posuere. Fusce nec iaculis mi. Fusce condimentum vestibulum elementum. Quisque malesuada est fringilla neque pulvinar, in malesuada enim viverra. Sed at malesuada est. Curabitur porttitor mi tortor. Maecenas luctus mollis eros, et efficitur erat vestibulum ac. Aliquam cursus nec nibh sed auctor. Etiam ante metus, mollis at venenatis vel, ornare eget lacus. Cras congue vel justo vitae pulvinar. Duis id justo sit amet turpis ullamcorper interdum id eu neque. Fusce ornare posuere ultrices. Vestibulum magna enim, laoreet a mauris eu, vulputate viverra neque. Nam volutpat convallis nulla at dictum. Integer accumsan risus eu elit aliquam accumsan. Fusce facilisis tincidunt sollicitudin. Aliquam suscipit lorem eu augue bibendum tempor. Sed lobortis dolor sapien, volutpat porttitor erat aliquet sit amet. Nulla tincidunt aliquam blandit. Sed non est at urna convallis faucibus.
When I tried that block of text, it took about 1s to paste the 4th time.
Alternatively, just paste it a few times without sending, and it is already slow. Delete without sending the message, and it will be fast again. If you paste it 100 times, it won't get slower, because it seems to be limited by the size of the input box. Also, making the window smaller doesn't seem to affect anything.
Not sure about Qt, but in Java, this can be caused by a String += in the code somewhere, so it has to allocate memory for a new String for each character it wants to add. A particularly bad algorithm might repeat this for every frame rendered. So you fix that by using java.util.StringBuilder instead.
And here's some verbose detail:
$ utox --version 0.1.8
$ lsb_release -a LSB Version: core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch Distributor ID: openSUSE project Description: openSUSE 20141208 (Tumbleweed) (x86_64) Release: 20141208 Codename: Tumbleweed
$ uname -a Linux peter 3.17.4-grsec-peter+ #1 SMP PREEMPT Tue Dec 2 23:04:12 CET 2014 x86_64 x86_64 x86_64 GNU/Linux
$ kde4-config --version Qt: 4.8.6 KDE Development Platform: 4.14.3 kde4-config: 1.0
$ dmesg | grep nouveau [ 12.240613] fb: switching to nouveaufb from VESA VGA [ 12.241243] nouveau [ DEVICE][0000:01:00.0] BOOT0 : 0x0c4100a1 [ 12.241249] nouveau [ DEVICE][0000:01:00.0] Chipset: GF104 (NVC4) [ 12.241253] nouveau [ DEVICE][0000:01:00.0] Family : NVC0 [ 12.241281] nouveau [ VBIOS][0000:01:00.0] checking PRAMIN for image... [ 12.335539] nouveau [ VBIOS][0000:01:00.0] ... appears to be valid [ 12.335546] nouveau [ VBIOS][0000:01:00.0] using image from PRAMIN [ 12.335632] nouveau [ VBIOS][0000:01:00.0] BIT signature found [ 12.335638] nouveau [ VBIOS][0000:01:00.0] version 70.04.1b.00.00 [ 12.577629] nouveau 0000:01:00.0: irq 28 for MSI/MSI-X [ 12.577648] nouveau [ PMC][0000:01:00.0] MSI interrupts enabled [ 12.686046] nouveau [ PFB][0000:01:00.0] RAM type: GDDR5 [ 12.686050] nouveau [ PFB][0000:01:00.0] RAM size: 1024 MiB [ 12.686053] nouveau [ PFB][0000:01:00.0] ZCOMP: 0 tags [ 12.688246] nouveau [ VOLT][0000:01:00.0] GPU voltage: 875000uv [ 12.716523] nouveau [ PTHERM][0000:01:00.0] FAN control: PWM [ 12.716538] nouveau [ PTHERM][0000:01:00.0] fan management: automatic [ 12.716553] nouveau [ PTHERM][0000:01:00.0] internal sensor: yes [ 12.716582] nouveau [ CLK][0000:01:00.0] 03: core 50 MHz memory 135 MHz [ 12.716589] nouveau [ CLK][0000:01:00.0] 07: core 405 MHz memory 324 MHz [ 12.716596] nouveau [ CLK][0000:01:00.0] 0c: core 405 MHz memory 1800 MHz [ 12.716604] nouveau [ CLK][0000:01:00.0] 0f: core 725 MHz memory 1800 MHz [ 12.716686] nouveau [ CLK][0000:01:00.0] --: core 50 MHz memory 135 MHz [ 12.718592] nouveau [ DRM] VRAM: 1024 MiB [ 12.718595] nouveau [ DRM] GART: 1048576 MiB [ 12.718600] nouveau [ DRM] TMDS table version 2.0 [ 12.718603] nouveau [ DRM] DCB version 4.0 [ 12.718607] nouveau [ DRM] DCB outp 00: 02000300 00000000 [ 12.718611] nouveau [ DRM] DCB outp 01: 01000302 00020030 [ 12.718614] nouveau [ DRM] DCB outp 02: 04011380 00000000 [ 12.718618] nouveau [ DRM] DCB outp 03: 08011382 00020030 [ 12.718621] nouveau [ DRM] DCB outp 04: 02022362 00020010 [ 12.718625] nouveau [ DRM] DCB conn 00: 00001030 [ 12.718628] nouveau [ DRM] DCB conn 01: 00010130 [ 12.718631] nouveau [ DRM] DCB conn 02: 00002261 [ 12.722267] nouveau [ DRM] MM: using COPY1 for buffer copies [ 12.868671] nouveau [ DRM] allocated 1920x1080 fb: 0x60000, bo ffff88044891c400 [ 12.868753] fbcon: nouveaufb (fb0) is primary device [ 12.945957] nouveau 0000:01:00.0: fb0: nouveaufb frame buffer device [ 12.946017] nouveau 0000:01:00.0: registered panic notifier [ 12.948737] [drm] Initialized nouveau 1.2.0 20120801 for 0000:01:00.0 on minor 0
peter:~ # z se -si mesa Loading repository data... Reading installed packages...
S | Name | Type | Version | Arch | Repository --+-------------------------+---------+-------------+--------+------------------ i | DirectFB-Mesa | package | 1.7.6-2.1 | x86_64 | repo-oss i | Mesa | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-demo-x | package | 8.2.0-3.2 | x86_64 | repo-oss i | Mesa-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-dri-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libEGL-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libEGL1 | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libGL-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libGL1 | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libGLESv1_CM-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libGLESv1_CM1 | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libGLESv2-2 | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libGLESv2-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libglapi-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libglapi0 | package | 10.3.3-99.1 | x86_64 | (System Packages) i | libOSMesa-devel | package | 10.3.3-99.1 | x86_64 | (System Packages) i | libOSMesa9 | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-32bit | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libEGL1-32bit | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libGL1-32bit | package | 10.3.3-99.1 | x86_64 | (System Packages) i | Mesa-libglapi0-32bit | package | 10.3.3-99.1 | x86_64 | (System Packages) i | libOSMesa9-32bit | package | 10.3.3-99.1 | x86_64 | (System Packages) peter:~ # z se -si X11 Loading repository data... Reading installed packages...
S | Name | Type | Version | Arch | Repository --+----------------------------+---------+----------------+--------+------------------ i | ConsoleKit-x11 | package | 0.4.6-5.1 | x86_64 | repo-oss i | dbus-1-x11 | package | 1.8.12-1.1 | x86_64 | repo-oss i | ghostscript-x11 | package | 9.15-2.1 | x86_64 | repo-oss i | libQt5X11Extras5 | package | 5.3.2-1.2 | x86_64 | repo-oss i | libX11-6 | package | 1.6.2-6.1 | x86_64 | repo-oss i | libX11-devel | package | 1.6.2-6.1 | x86_64 | repo-oss i | libX11-xcb1 | package | 1.6.2-6.1 | x86_64 | repo-oss i | libqt4-x11 | package | 4.8.6-10.1 | x86_64 | repo-oss i | libva-x11-1 | package | 1.4.1-1.1 | x86_64 | repo-oss i | libxkbcommon-x11-0 | package | 0.5.0-1.1 | x86_64 | repo-oss i | patterns-openSUSE-x11 | package | 20141007-7.1 | x86_64 | (System Packages) i | patterns-openSUSE-x11_opt | package | 20141007-7.1 | x86_64 | (System Packages) i | patterns-openSUSE-x11_yast | package | 20141007-7.1 | x86_64 | (System Packages) i | perl-X11-Protocol | package | 0.56-14.1 | x86_64 | repo-oss i | x11perf | package | 1.5.4-10.1 | x86_64 | repo-oss i | x11vnc | package | 0.9.13-11.1 | x86_64 | repo-oss i | xorg-x11-Xvnc | package | 1.3.1-11.1 | x86_64 | repo-oss i | xorg-x11-driver-video | package | 7.6_1-15.1 | x86_64 | repo-oss i | xorg-x11-server | package | 7.6_1.16.2-1.1 | x86_64 | repo-oss i | yast2-x11 | package | 3.1.3-3.2 | x86_64 | repo-oss i | libX11-data | package | 1.6.2-6.1 | noarch | repo-oss i | x11-tools | package | 0.1-204.1 | noarch | repo-oss i | xorg-x11 | package | 7.6_1-16.1 | noarch | repo-oss i | xorg-x11-devel | package | 7.6-47.1 | noarch | repo-oss i | xorg-x11-driver-input | package | 7.6_1-13.1 | noarch | repo-oss i | xorg-x11-essentials | package | 7.6_1-16.1 | noarch | repo-oss i | xorg-x11-fonts | package | 7.6-31.1 | noarch | repo-oss i | xorg-x11-fonts-core | package | 7.6-31.1 | noarch | repo-oss i | xorg-x11-libX11-ccache | package | 7.6-20.1 | noarch | repo-oss i | xorg-x11-libs | package | 7.6-47.1 | noarch | repo-oss i | xorg-x11-util-devel | package | 7.6_1-10.1 | noarch | repo-oss i | libX11-6-32bit | package | 1.6.2-6.1 | x86_64 | repo-oss i | libX11-xcb1-32bit | package | 1.6.2-6.1 | x86_64 | repo-oss i | libqt4-x11-32bit | package | 4.8.6-10.1 | x86_64 | repo-oss i | x11 | pattern | 20141007-7.1 | x86_64 | (System Packages) i | libxkbcommon-x11-0_4_3 | package | 0.4.3-1.1 | x86_64 | (System Packages)
$ cat /proc/cpuinfo ... model name : AMD FX(tm)-8150 Eight-Core Processor ...
[21:25:17] <`michiru> it gets more laggy when you paste lorem impsum about >10 times
[21:26:34] <`michiru> but it's more about general lagginess, not just text input
[21:26:49] <`michiru> buttons take longer time to change color on hover etc.
I think this has doto with needing to make xlib calls to find the size... replace with xcb once confirmed?