Bug 487271 - [GTK3] Program freezes on initial _gtk_combo_box_text_insert
Summary: [GTK3] Program freezes on initial _gtk_combo_box_text_insert
Status: CLOSED DUPLICATE of bug 489640
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5.1   Edit
Hardware: PC Linux
: P2 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance, triaged
Depends on:
Blocks:
 
Reported: 2016-02-04 13:24 EST by Dirk Beele CLA
Modified: 2018-05-29 10:48 EDT (History)
8 users (show)

See Also:


Attachments
Snippet to reproduce the bug (1.41 KB, application/octet-stream)
2017-10-20 05:19 EDT, Michael Seele CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Beele CLA 2016-02-04 13:24:56 EST
Maybe this is a Duplicate of Bug 472453, which was closed as worksforme. But in our Application it is easy to reproduce it.

We are running an eclipse RCP Application (based on Mars 4.5.1) on a 64Bit Linux (Ubuntu 14.04). Whenever you try to set a large amount (> 200) of Combo items via Combo#setItems(String[] items) the UI freezes (for ~ 5 seconds or longer).

If you send the the Program a 'kill -s QUIT' to get a stacktrace you get the following trace:

"main" #1 prio=6 os_prio=0 tid=0x00007f31e000c800 nid=0x48fd runnable [0x00007f31e74fc000]
   java.lang.Thread.State: RUNNABLE
	at org.eclipse.swt.internal.gtk.OS._gtk_combo_box_text_insert(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_combo_box_text_insert(OS.java:7106)
	at org.eclipse.swt.widgets.Combo.setItems(Combo.java:2050)

We got an editor deploying 5 Combo Boxes with 200 items each (Selection of countries in an address record) and it takes up to 35 seconds to load on a normal client Hardware (3 years old Core i7 with 4 cores and 16 GB RAM). 

The same Applikation is running fine without delay on Windows 7/8/10, 32/64 Bit and Mac OS 10.11.3.
Comment 1 Andrey Loskutov CLA 2016-02-04 14:03:41 EST
Is this reproducible on GTK2 too? Set SWT_GTK3=0 before starting Eclipse to test it.
Comment 2 Dirk Beele CLA 2016-02-05 03:13:05 EST
Thank you Andrey for your fast response.

No, setting SWT_GTK3=0 before starting the Application (export SWT_GTK3=0 on the bash command line, then starting App from the same shell) solves the Problem.

The performance is similar to Windows 7/8/10, 32/64 Bit and Mac OS 10.11.3. when using GTK 2.
Comment 3 Julian Casadesus CLA 2016-02-12 16:49:01 EST
I'm having same problem when call Combo.setItems(...) and Combo.add(...) for large lists.

It happens since 4.5, with SWT_GTK3=1 and SWT.READ_ONLY flag.
Removing SWT.READ_ONLY it works fine.
Comment 4 Andrei Neshcheret CLA 2016-11-18 06:17:12 EST
Same problem here. 
On Ubuntu 16.94 64bit unix with gtk3 and rcp application base on eclipse 4.6.0
Comment 5 Michael Seele CLA 2017-10-20 05:19:45 EDT
Created attachment 271107 [details]
Snippet to reproduce the bug

I can confirm the bug with swt 4.7.1a under Ubuntu 16.04 (gtk3.18.9) and CentOS 7 (gtk3.22.10).

For me it looks like the used method org.eclipse.swt.internal.gtk.OS.gtk_combo_box_text_insert(long, int, byte[], byte[]) is very very slow the more items are in the combo box.

Please se the attached snippet which reproduces the bug. Here are the results for gtk3:

OS.GTK3: true
10 items: 838 millis
100 items: 854 millis
250 items: 3413 millis
500 items: 12689 millis
1000 items: 52800 millis
1500 items: 129058 millis
2000 items: 263006 millis

Here are the results under gtk2:

OS.GTK3: false
10 items: 249 millis
100 items: 63 millis
250 items: 108 millis
500 items: 169 millis
1000 items: 426 millis
1500 items: 803 millis
2000 items: 1391 millis

Is there anything going on here? This is really a blocker for us (because we have ~2500 items in a combo box in our application).

btw, these are the results without read only style (i've used border style):

OS.GTK3: true
10 items: 632 millis
100 items: 380 millis
250 items: 413 millis
500 items: 473 millis
1000 items: 706 millis
1500 items: 1023 millis
2000 items: 1625 millis

OS.GTK3: false
10 items: 233 millis
100 items: 82 millis
250 items: 79 millis
500 items: 119 millis
1000 items: 268 millis
1500 items: 459 millis
2000 items: 700 millis
Comment 6 Leo Ufimtsev CLA 2017-10-31 14:35:02 EDT
We should investigate..
Comment 7 Leo Ufimtsev CLA 2018-05-29 10:48:16 EDT

*** This bug has been marked as a duplicate of bug 489640 ***