JavaFX FadeTransistion会导致巨大的CPU负载
在滚动窗格中嵌套的HBox(容器)内有一个简单的矩形。 此矩形应用了以下转换:JavaFX FadeTransistion会导致巨大的CPU负载,java,performance,javafx,Java,Performance,Javafx,在滚动窗格中嵌套的HBox(容器)内有一个简单的矩形。 此矩形应用了以下转换: attentionRectangle = new Rectangle(1, 1, container.getWidth(), container.getHeight()); attentionRectangle.setManaged(false); attentionRectangle.setFill(Color.LIME); attentionRectangleTransition = new FadeTran
attentionRectangle = new Rectangle(1, 1, container.getWidth(), container.getHeight());
attentionRectangle.setManaged(false);
attentionRectangle.setFill(Color.LIME);
attentionRectangleTransition = new FadeTransition(Duration.millis(3000), attentionRectangle);
attentionRectangleTransition.setFromValue(0.2);
attentionRectangleTransition.setToValue(0.8);
attentionRectangleTransition.setCycleCount(Timeline.INDEFINITE);
attentionRectangleTransition.setAutoReverse(true);
attentionRectangleTransition.play();
现在可以注意到并复制以下行为(至少在我的项目中):
1.如果滚动窗格完全为空,则java机器的CPU负载为~1%
2.如果带有闪烁矩形的元素单独位于滚动窗格中,则Java的CPU负载约为3-4%
3.如果其他没有闪烁的简单元素在滚动窗格中,cpu负载约为2-3%
4.如果简单的元素和闪烁的元素在滚动窗格中,那么CPU负载将猛增到15-17%,这几乎是一个完全加载的虚拟线程(由于我的机器上有8个可用线程)
这正常吗?
还是有人有改进的建议
我真的很感激
如果使用“-Dprism.verbose=true”执行控制台输出:
最后一行发生在动画开始时 你在什么操作系统和硬件上运行这个?在使用
java-Dprism.verbose=true
运行时,是否可以包含输出(以查看使用的渲染管道)?@sillyfly感谢您的回答!在intel Haswel e3 1230v3和Radeon RX 480上开发Win 10。将在问题中添加详细的结果!
Prism pipeline init order: d3d sw
Using native-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
Loading D3D native library ...
succeeded.
D3DPipelineManager: Created D3D9Ex device
Direct3D initialization succeeded
(X) Got class = class com.sun.prism.d3d.D3DPipeline
Initialized prism pipeline: com.sun.prism.d3d.D3DPipeline
Maximum supported texture size: 16384
Maximum texture size clamped to 4096
OS Information:
Windows version 10.0 build 16299
D3D Driver Information:
Radeon (TM) RX 480 Graphics
\\.\DISPLAY1
Driver aticfx32.dll, version 22.19.677.257
Pixel Shader version 3.0
Device : ven_1002, dev_67DF, subsys_94801682
Max Multisamples supported: 4
vsync: true vpipe: true
Loading Prism common native library ...
succeeded.
PPSRenderer: scenario.effect - createShader: LinearConvolveShadow_8
PPSRenderer: scenario.effect - createShader: LinearConvolveShadow_16
PPSRenderer: scenario.effect - createShader: LinearConvolveShadow_12
PPSRenderer: scenario.effect - createShader: LinearConvolveShadow_4
PPSRenderer: scenario.effect - createShader: LinearConvolveShadow_20