FireMonkey Performance Issues

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 09:27:57

问题


I am using Delphi XE2 with update 4 hotfix 1

My default FMX app is stating very slow and on event it is freezing for a while. Eg: when i click on a button, the whole application freezes for some seconds(but only for the first execution of that event). So i thought it might be a GPU problem and edited my default Dpr file as ;

uses
  FMX.Forms,  fmx.Types,..

{$R *.res}

begin
  Application.Initialize;

  GlobalUseHWEffects := False   ;
  GlobalUseDirect2D := False  ;
  GlobalUseDirect2DSoftware := False    ;
  GlobalUseGDIPlusClearType := True    ;
  GlobalDisableFocusEffect := True   ;

  Application.CreateForm(...);
  Application.Run;
end.

Now it works as i expected without any problem, but the CPU usage is as previous(25% when moving mouse)

Then i modified my code as

  GlobalUseHWEffects := true  ;
  GlobalUseDirect2D := False  ;
  GlobalUseDirect2DSoftware := False    ;
  GlobalUseGDIPlusClearType := True    ;
  GlobalDisableFocusEffect := True   ;

Now everything is working smooth , only a small delay in statup time and CPU usage is very low (0 - 2 %).(that's why i need Firemonkey)

now all the controls are working as expected except Menubar, above settings are not applied to menubar and it is working with default behavior(whole app freezes for some seconds).

What can i do to over come this problem.


回答1:


The real problem was with some firemonkey Effects and Firemonkeys default settings

default GlobalUseDirect2D = true while GlobalUseHWEffects := true is the real cause for performance issue, enabling both is using both CPU and GPU in my machine.So make one of them to false. I recommend you to do GlobalUseDirect2D = false and GlobalUseHWEffects := true for less usage of CPU.

And now you will be also able to get improved fonts (best ever firemonkey can generate)

Not all the customers will have high end Graphic GPUs

I am using an Intel Mobile graphic chip, so i don't think my one will have all the capabilities to support all firemonkey effects. following the code and comment can be seen in FMX.Types

// On low-end hardware or mobile bitmap effects are slowly
  GlobalDisableFocusEffect: Boolean = False;

but i can't understand why they have made it false by default.(so enable and disable depends on client GPU capabilities)

by GlobalDisableFocusEffect you will no more able to use Effects (eg: outergloweffect ).... but again this statement is still no more true....

by GlobalDisableFocusEffect not all the effects are disabled,

for example

  1. Tinnergloweffect in button style in windows style is the reason for freezing
  2. Tinnergloweffect in headeritemstyle in Dark style is the reason freezing.

and there may be tons of example...

So in my scenario i was forced to remove all effects form the style.., Blend , Dark styles are working much better because they use less TEffects (?) ,but now i am having a better GUI with better performance (I feel Blend and Dark styles look cool than native like UIs )



来源:https://stackoverflow.com/questions/10878064/firemonkey-performance-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!