Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic performance of darklaf #161

Open
kirill-grouchnikov opened this issue May 4, 2020 · 3 comments
Open

Dynamic performance of darklaf #161

kirill-grouchnikov opened this issue May 4, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@kirill-grouchnikov
Copy link

I use Lightbeam in Substance to track performance regressions and measure potential performance improvements. Every once in a while I run it on a selection of core and third-party look-and-feels to see how Substance stacks up.

I just ran the performance suite on the latest stable release of darklaf, and I'm seeing darklaf numbers that are like this:

image

As you can see, other look-and-feels are more or less on the same level. There are a couple that use drop shadows on the menus, and that adds extra cost. There are also two LAFs that are base on Synth (Nimbus and Synthetica) that seem to have performance issues with sliders. But otherwise it's pretty close. Except for darklaf. The whole Lightbeam suite stutters and lags to refresh the UI, and the numbers seem to back that up.

I downloaded the latest stable darklaf binaries from https://search.maven.org/search?q=darklaf and svgsalamander from https://search.maven.org/search?q=svgsalamander

To build Lightbeam locally, download the latest zip from Radiance's Github, and run gradlew, gradlew copyJars, gradlew getAllDependencies.

Then, to run Lightbeam with darklaf:

export JAVA_HOME=`/usr/libexec/java_home -v 9`
alias JAVA="java"

RADIANCE_VERSION=3.0-SNAPSHOT
CLASSPATH=../../drop/$RADIANCE_VERSION/tools/radiance-lightbeam-$RADIANCE_VERSION.jar:../../build/libs-tools/jgoodies-forms-1.9.0.jar:../../build/libs-tools/jgoodies-common-1.8.1.jar
DARKLAF_CLASSPATH=../../../thirdparty/darklaf/*

java -Dswing.defaultlaf=com.github.weisj.darklaf.DarkLaf -cp $CLASSPATH:$DARKLAF_CLASSPATH org.pushingpixels.lightbeam.DynamicPerformanceSuite 10

The location of lightbeam and jgoodies jars matches where the Radiance build script will put them. The location of darklaf jars can be tweaked to match what you have on your system.

Let me know if you have questions on how Lightbeam works beyond the documentation at https://github.com/kirill-grouchnikov/radiance/blob/master/docs/tools/lightbeam/lightbeam.md

@kirill-grouchnikov
Copy link
Author

https://github.com/kirill-grouchnikov/radiance/blob/master/tools/lightbeam/src/main/java/org/pushingpixels/lightbeam/panels/ButtonsPanel.java#L441 is the code for the first scenario - dynamically change JButton texts and measuring how much it takes to complete that and repaint the button panel.

@weisJ
Copy link
Owner

weisJ commented May 4, 2020

Thank you for the insight. I’ll have a look at what causes the performance issues.

@weisJ weisJ added the enhancement New feature or request label May 25, 2020
@weisJ
Copy link
Owner

weisJ commented May 25, 2020

After doing some analysis I could mitigate some of the performance issues. Most time was wasted painting the svg icons and doing heavy Area calculations during painting. After adding image caching to the DarkSVGIcon implementation and removing unnecessary usage of Area I could improve the performance to where it is at ~2700 compared to the system laf at ~2100.

Still the first few iterations are a lot worst that the system laf (in the order of x2 or x3) because the icons are being loaded lazily.

Still some work to be done but a good first start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants