Skip to content

new Composite().dispose() is slow on Mac OS #912

@basilevs

Description

@basilevs

Creation and disposal of a Composite on Mac OS are very slow

To Reproduce
Run

public void test_createComposites() {
PerformanceMeter meter = createMeter("Create composites");
int samples;
Performance.getDefault();
// Warm up.
for(samples = 0; samples < 2; samples++) {
Shell shell = new Shell(display);
for (int i = 0; i < 100; i++) {
Composite c = new Composite(shell, SWT.NONE);
for (int j = 0; j < 10; j++) {
new Composite(c, SWT.NONE);
}
}
shell.dispose();
while(display.readAndDispatch()){/*empty*/}
}
for(samples = 0; samples < 100; samples++) {
Shell shell = new Shell(display);
meter.start();
for (int i = 0; i < 100; i++) {
Composite c = new Composite(shell, SWT.NONE);
for (int j = 0; j < 50; j++) {
new Composite(c, SWT.NONE);
}
}
meter.stop();
shell.dispose();
while(display.readAndDispatch()){/*empty*/}
}
disposeMeter(meter);
}

It takes 28 minutes to execute on Mac OS

Expected behavior

The test should complete in seconds, like on Linux and Windows.

Screenshots

Screenshot 2023-11-27 at 23 50 25

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Reproducible in CI
    Reproducible on MacOS Monterey

  2. JRE/JDK version
    17

Version since
The test performance meter was implemented incorrectly - it failed to measure deferred events.
Performance tests were never run on CI and performance assertions were disabled three years ago.
eclipse-platform/eclipse.platform.releng@071af51#diff-55cfefb6d6ca7ae136d8057fc7ea93d8b62af5db44fc77cec0f961fc68d2bdbdL85
So the exact date of regression is unclear.

Workaround (or) Additional context
Don't create composites on MacOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions