Alcinoe icon indicating copy to clipboard operation
Alcinoe copied to clipboard

Poor performance in mouse operations

Open viniciusfbb opened this issue 6 years ago • 11 comments

https://github.com/Zeus64/alcinoe/blob/329361c3c51cd40f09eec1597e33780b36f94eb1/references/embarcadero/rio/10_3_1/patched/fmx/FMX.Controls.pas#L509-L513

All components are losing performance in mouse operations because of this. An easy demo would be when we click a button (keeping the mouse down) and see its animation performing poorly, especially on android phones. You wanted to pass along the mouse operations to be captured by ScrollBox, for example, even when the component inside it have HitTest True, but that way all controls lose performance.

An "ugly" but simple solution would be for the programmer to manually pass these mouse operations over to ScrollBox when needed, creating this same procedures but they will trigger just when the programmer call it, not in ever mouse operations of all controls.

(Sorry for my bad english)

viniciusfbb avatar Aug 18 '19 18:08 viniciusfbb

hmm, that strange, I didn't see any performance loss in my test. In fact, I even see a performance improvement. do you have a demo or something like this that I could test? actually, https://play.google.com/store/apps/details?id=club.kiskis.app&hl=en is made with this and there is not performance penalty but maybe your scenario is different ...

Zeus64 avatar Aug 18 '19 19:08 Zeus64

Correction: Slowness is in ChildrenMouseXXX override implemented in TALCustomScrollBox

https://github.com/Zeus64/alcinoe/blob/329361c3c51cd40f09eec1597e33780b36f94eb1/source/ALFmxLayouts.pas#L886-L928

Here is the demo: Alcinoe_Inssue_Demo.zip

viniciusfbb avatar Aug 19 '19 01:08 viniciusfbb

I still don't fully understand it, but the issue is solved by removing this line:

https://github.com/Zeus64/alcinoe/blob/329361c3c51cd40f09eec1597e33780b36f94eb1/source/ALFmxInertialMovement.pas#L792

viniciusfbb avatar Aug 19 '19 17:08 viniciusfbb

I will take a look at it ! thanks !

Zeus64 avatar Aug 19 '19 21:08 Zeus64

Stephane, I found the real problem. It is here:

https://github.com/Zeus64/alcinoe/blob/329361c3c51cd40f09eec1597e33780b36f94eb1/references/embarcadero/rio/10_3_1/patched/fmx/FMX.Platform.UI.Android.pas#L2337-L2341

Just remove it.

viniciusfbb avatar Aug 24 '19 14:08 viniciusfbb

I ran your demo, With_Children and Without_Children and there is absolutely no difference :( what phone are you using for your test?

Zeus64 avatar Aug 24 '19 14:08 Zeus64

Android Galaxy S8+ The problem is your changes in FMX.Platform.UI.Android.pas.

When the button is pressed, you are rendering the animation only when the mouse moves, but when the mouse is stopped, the animation is not rendered.

viniciusfbb avatar Aug 24 '19 14:08 viniciusfbb

as far as I see there is no impact, did you run the app in debugging? can you try to run it in release just to see?

Zeus64 avatar Aug 24 '19 15:08 Zeus64

@viniciusfbb do you still have the problem ? today i face a strange problem where everything was very slow. I uninstall the app from the mobile, delete all dcu, clean everything, and rebuild and resinstall the app and it's start again to work well and fast. I absolutely have no idea why at the beginning the app was running slow :(

Zeus64 avatar Apr 13 '20 13:04 Zeus64

@Zeus64 That was a long time ago, I don’t remember, but in my git it’s registered that the solution to this was to change the FMX.Platform.UI.Android.pas. https://github.com/viniciusfbb/alcinoe/commit/21997b61d6c43722b976b8debdadba3e0a1ba38c

I think this was the solution, but anyway it was solved at the time, I still use Alcinoe, not everything, but I use the fixes, TALTexture, TALAnimation and TALVertScrollBox, with Delphi 10.3.3, both for Android and for iOS it is working perfectly and very quickly. Much faster than native Delphi components!

viniciusfbb avatar Apr 16 '20 11:04 viniciusfbb

@Zeus64 If you still haven't solved the problem, I found another change here at the time in ALFmxInertialMovement.pas:

procedure TALAniCalculations.TDisplayLinkListener.displayLinkUpdated;	
begin	
  if not fAniCalculations.Down then ///////// <<<<<<<<<<<
  begin	
    if assigned(fAniCalculations.fOnTimer) then	
      fAniCalculations.fOnTimer(fAniCalculations)	
    else	
      fAniCalculations.Calculate;	
  end;	
end;

viniciusfbb avatar Jun 03 '20 13:06 viniciusfbb