You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class Snippet1 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(200, 200);
shell.setLayout(new FillLayout());
shell.setText("Snippet 1");
Scale scale = new Scale(shell, SWT.NONE);
scale.setMinimum(0);
scale.setMaximum(100000000);
long start = System.currentTimeMillis();
System.out.println("Open Shell");
shell.open();
System.out.println("Open returned after " + ((System.currentTimeMillis() - start) / 1000d) + "s");
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Running this under Windows 11 gives the following output and makes the CPU heating up, UI is reported as "unresponsive":
Open Shell
Open returned after 16.504s
Even for smaller numbers one can observe this, e.g. without the scale it take 20 ms to bring up the UI, using the scale with any number < 10.000 it is about 30 ms from 100.00 it already takes 100ms and from 10.000.000 it is already > 3 seconds.
While for a single scale this is often not noticable, if many are used that can change their min/max values dynamically this can easily lead to the user things the UI is lagging or even froozen.
The text was updated successfully, but these errors were encountered:
Consider the following code:
Running this under Windows 11 gives the following output and makes the CPU heating up, UI is reported as "unresponsive":
Even for smaller numbers one can observe this, e.g. without the scale it take 20 ms to bring up the UI, using the scale with any number < 10.000 it is about 30 ms from 100.00 it already takes 100ms and from 10.000.000 it is already > 3 seconds.
While for a single scale this is often not noticable, if many are used that can change their min/max values dynamically this can easily lead to the user things the UI is lagging or even froozen.
The text was updated successfully, but these errors were encountered: