Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 279474 Details for
Bug 549644
[GTK3] Shell dispose slowdown
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
MenuItemSnippet
SnippetMenuItemDispose.java (text/x-java), 2.41 KB, created by
Patrick Tasse
on 2019-08-01 15:32:46 EDT
(
hide
)
Description:
MenuItemSnippet
Filename:
MIME Type:
Creator:
Patrick Tasse
Created:
2019-08-01 15:32:46 EDT
Size:
2.41 KB
patch
obsolete
> >import java.util.Arrays; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Group; >import org.eclipse.swt.widgets.Menu; >import org.eclipse.swt.widgets.MenuItem; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.swt.widgets.TabFolder; >import org.eclipse.swt.widgets.TabItem; > >public class SnippetMenuItemDispose { > > private static final int NUM_ITERATIONS = 100; > private static final int NUM_TABS = 100; > private static final int NUM_MENU_ITEMS = 40; > > public static void main(String[] args) { > Display display = new Display(); > System.out.println("gtk version: " + System.getProperty("org.eclipse.swt.internal.gtk.version")); > System.out.println("SWT version: " + SWT.getVersion()); > System.out.println(); > > for (int numTabs : Arrays.asList(0, NUM_TABS)) { > for (int numMenuItems : Arrays.asList(0, numTabs == 0 ? NUM_TABS * NUM_MENU_ITEMS : NUM_MENU_ITEMS)) { > for (int i = 1; i <= NUM_ITERATIONS; i++) { > final Shell shell = new Shell(display, SWT.SHELL_TRIM); > shell.setLayout(new FillLayout()); > long t1 = System.currentTimeMillis(); > Menu popup = new Menu(shell); > if (numTabs == 0) { > shell.setMenu(popup); > for (int k = 0; k < numMenuItems; k++) { > new MenuItem(popup, SWT.PUSH); > } > } else { > TabFolder tabFolder = new TabFolder(shell, SWT.NONE); > for (int j = 0; j < numTabs; j++) { > TabItem item = new TabItem(tabFolder, SWT.NONE); > item.setText(Integer.toString(j)); > Composite composite = new Composite(tabFolder, SWT.NONE); > Group group = new Group(composite, SWT.NONE); > group.setMenu(popup); > for (int k = 0; k < numMenuItems; k++) { > new MenuItem(popup, SWT.PUSH); > } > item.setControl(composite); > } > } > long t2 = System.currentTimeMillis(); > System.out.print(String.format("Shell%s with popup Menu with %d MenuItem [%3d]\tcreate %4d ms\t", numTabs == 0 ? "" : " with " + numTabs + " TabItem", numMenuItems, i, (t2-t1))); > long t3 = System.currentTimeMillis(); > shell.dispose(); > long t4 = System.currentTimeMillis(); > System.out.print(String.format("dispose %4d ms\t", (t4-t3))); > for (int n = 0; n < (t4-t3); n+=10) { > System.out.print("="); > } > System.out.println(); > } > System.out.println(); > } > } > display.dispose(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 549644
:
279428
|
279462
| 279474