My JavaFX app is managed by efficiency cores once reduced in tray icon.

47 views
Skip to first unread message

Davide Perini

unread,
May 23, 2023, 3:31:21 PM5/23/23
to jna-...@googlegroups.com
As title.
I'm pretty sure that my JavaFX app is managed by efficiency cores once
reduced in tray icon since its performance drops significantly,
if I open a window and leave it open, the app goes at max speed on
performance cores.

Is there a way to set the app runs on performance core even without
leaving a window opened?

Thanks
Davide

Tres Finocchiaro

unread,
May 24, 2023, 12:11:43 AM5/24/23
to jna-...@googlegroups.com
I'm pretty sure that my JavaFX app is managed by efficiency cores once
reduced in tray icon since its performance drops significantly,
if I open a window and leave it open, the app goes at max speed on
performance cores.

Hi, there are many factors at play with a JavaFX application.  In my experience, the JavaFX stage performs significantly differently when certain components are not "shown", so this may be a better question for the JavaFX community.

For example, using a small animation example with Platform.setImplicitExit(false);, the CPU usage significantly drops when the stage is hidden.
https://www.tutorialspoint.com/javafx/javafx_animations.htm

Is there a way to set the app runs on performance core even without
leaving a window opened?

Although what you're describing may be possible with JNA, since JavaFX has strong ties to the Java community, this may be better asked in FX-specific channels.

As a personal note -- and offtopic to this mailing list -- I've found myself leveraging custom "Monocle" builds of JavaFX for when the stage is hidden.  I've had bad experiences with a hidden stage otherwise.  I'm not sure how helpful this is though, considering Monocle's original intent was for JavaFX instances that didn't have a UI at all.

L Will Ahonen

unread,
May 24, 2023, 7:20:19 AM5/24/23
to Java Native Access
Hi,

Are you sure you're not dealing with the foreground priority boost from Windows? https://learn.microsoft.com/en-us/windows/win32/procthread/priority-boosts

Does your app retain the high priority if you keep the window un-minified, but leave it hidden behind other windows?

Cheers,
Will

Davide Perini

unread,
May 24, 2023, 3:09:06 PM5/24/23
to jna-...@googlegroups.com
I'm not sure how to check it, the only thing I know is that while the app runs in background in the tray icon the performance drop after a while,
if I open a window, and leave it opened, the performance does not drop.

How can I check if it's the foreground priority boost from Windows and if it's that the case,
how can I tell to windows to stop setting my threads in a low priority state? :)

Thank you very much for the answer.

Davide
--
You received this message because you are subscribed to the Google Groups "Java Native Access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jna-users/4cdc35f7-548d-4121-8fbd-b4ef8c0c8207n%40googlegroups.com.

Václav Haisman

unread,
May 24, 2023, 4:54:19 PM5/24/23
to jna-...@googlegroups.com
On 24. 05. 23 21:09, Davide Perini wrote:
I'm not sure how to check it, the only thing I know is that while the app runs in background in the tray icon the performance drop after a while,
if I open a window, and leave it opened, the performance does not drop.

How can I check if it's the foreground priority boost from Windows and if it's that the case,
how can I tell to windows to stop setting my threads in a low priority state? :)

It seems to me you have to manually change the QoS for the process. See https://learn.microsoft.com/en-us/windows/win32/procthread/quality-of-service for QoS information. It looks like you would have to call SetProcessInformation with ProcessPowerThrottling and StateMask=0. I have no idea if JNA supports these calls.


Davide Perini

unread,
May 25, 2023, 5:05:07 AM5/25/23
to jna-...@googlegroups.com
Is this something similar to manually set the process priority in the task manager?
I maean this thing:
https://windowsreport.com/task-manager-set-priority/

if yes, it seems that highering the priority does not help, only opening a window on my app helps.
no matter if the windows is behind other windows.

Thanks
Davide
Reply all
Reply to author
Forward
0 new messages