eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
112 stars 134 forks source link

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

Open basilevs opened 10 months ago

basilevs commented 10 months ago

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

To Reproduce Run https://github.com/eclipse-platform/eclipse.platform.swt/blob/02c8a22116599a507db2dd424dd20cc778db64d4/tests/org.eclipse.swt.tests/JUnit%20Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java#L72-L105

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
      • [x] macOS
  2. Additional OS info (e.g. OS version, Linux Desktop, etc) Reproducible in CI Reproducible on MacOS Monterey

  3. 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. https://github.com/eclipse-platform/eclipse.platform.releng/commit/071af511debfd17e1c12a66e7d79d93e943ae2cd#diff-55cfefb6d6ca7ae136d8057fc7ea93d8b62af5db44fc77cec0f961fc68d2bdbdL85 So the exact date of regression is unclear.

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

basilevs commented 10 months ago

History of performance tests by @akurtakov : https://github.com/eclipse-platform/eclipse.platform.swt/pull/906#issuecomment-1828505166

akurtakov commented 10 months ago

For the record - Perf tests results (at least as far as I'm aware) have only be produced by the project on Linux. I was never involved nor remember anything about anyone using these perf tests on Win/Mac in the open.

basilevs commented 10 months ago

I'd like to prevent regressions like this from happening again. The first step that comes to mind - instead of tracking perf data externally, add a sensible assertion in the test code.

However, I'm not sure what is sensible. Is 250 ms per Composite normal on MacOS?

akurtakov commented 10 months ago

Unfortunately, I have found any timing in VMs to be totally unreliable. Sometimes VMs just "sleep" for extended periods and next time they "wakeup" the wallclock is already above any threshold even though the VM was not active and thus did nothing.

iloveeclipse commented 10 months ago

Exact, we see same in our internal tests in VM's. Any time/performance results totally unreliable

basilevs commented 10 months ago

Here, the test takes 28 minutes, how unreliable should VM be to skip half an hour?

iloveeclipse commented 10 months ago

Depends on how host is configured and how many other instances use same hardware.I saw pauses of ~15 minutes , where the VM itself was not doing anything.

akurtakov commented 10 months ago

Here, the test takes 28 minutes, how unreliable should VM be to skip half an hour?

If it's github runner - it might have been affected by the degraded GHA right now https://www.githubstatus.com/

basilevs commented 8 months ago

The test was done on physical Mac Book Pro produced in 2021 and still took 28 minutes. VM slowdowns do not justify/explain the performance.