| Summary: | Flickering when using many items in Combo | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Markus Knauer <mknauer> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | ivan |
| Version: | 2.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | |||
The Combo width is based on it's content and it is calculated in Combo#computeSize methods. With 10000 items in Combo, the text size determination have to probe all of them for correct Combo size. This leads to many requests.... but I have a feeleing that something is not working correctly here (text size determination). Still under investigation... (In reply to Ivan Furnadjiev from comment #1) > ...but I have a feeling that something is not working correctly here That was my gut feeling, too, and it was the reason why I filed this bug. It's definitively *not* a question that 10000 items in a Combo is a bad idea. Thanks for looking into this! Found it... TextSizeStorage has a hard codded maximum limit of 10000 elements (see TextSizeStorage#DEFAULT_STORE_SIZE). After this limit is reached, 1/10 of the measured text sizes are removed - free space for 1000 new elements. As Combo contains 10000 different items, they can't fit all together in the storage size, which leads to endless response/requests. ... but I think that adding 10000 elements (texts) for measuring at once is not common. Just did a memory profiling of simple entry point with 10000 entries in TextSizeStorage. The overall memory consuption of TextSizeStorage (10000 stored entries) is less than megabyte ( 860kB ) and we could increase DEFAULT_STORE_SIZE if we consider it useful. I didn't measure what will be the difference of HashMap lookup performance. To have 10000 text entries for measurement at once is unusual. I'll close it as WONTFIX. Please reopen if you disagree. |
The following code snipped adds 10000 items to a combo (yes, I know that it is not suggested to use that many items in a combo, and yes, I know that it would be probably better to use something else, e.g. autosuggest) but... my point here in this bug report is the flickering and the endless changes of the size of all widgets, including the two buttons that are on top of the combo. protected void createContents(Composite parent) { parent.setLayout(new GridLayout(1, false)); Button checkbox = new Button(parent, SWT.CHECK); checkbox.setText("Hello"); Button button = new Button(parent, SWT.PUSH); button.setText("World"); Combo combo = new Combo(parent, SWT.NONE); combo.setItems(generateItems()); } private String[] generateItems() { Collection<String> result = new ArrayList<String>(); for (int ii = 0; ii < 10000; ii++) { result.add(ii + " item"); } return result.toArray(new String[result.size()]); } I've seen this in FF 31.2, IE 10, Chrome 38.