I guess for 2.6.1 I need to crosscompile them on my own?
The FPS is very low compared to if you run it in Windows and I'm wondering if all these pauses are making things slower?
Quote from: meanderix on April 02, 2012, 04:02:16 pmThe FPS is very low compared to if you run it in Windows and I'm wondering if all these pauses are making things slower?Why do you think that those are pauses? Those are garbage collector messages, they seam to be generated on every repaint and nothing indicates that they are a problem, although it could be.
Originally I thought they were related to the fact that I didn't free strings generated via NewStringUTF, and you don't really need to free them, the garbage collector takes care of that. Now I added explicit code to free them and I couldn't note any difference, so I have no idea anymore.It is very hard to say what makes things slower then they could be because I already did a lot of optimizing now. We really need to start doing profiling of various parts and see where optimizations can be achieved.
Ok, I've optimized the repaint process a bit (I'm accessing TLazCanvas using Canvas.Handle.) It's faster now, but it seems the bottleneck is really the timer. It seems the timer is triggered only about every 200ms, even if I have an interval of 1ms.
// input: int lcltimerinterval in milliseconds // output: Runnable lcltimerid public void LCLDoCreateTimer() { lcltimerid = new LCLRunnable(); LocalHandler.removeCallbacks(lcltimerid); LocalHandler.postDelayed(lcltimerid, lcltimerinterval); };
It would be great if I could use Application.OnIdle -- but that does not seem to be triggered at the moment. I'll take a look at other possibilities.
I managed to get the GradLines_Ex example project running on my SGS2, but I had to remove the memo control, otherwise it would crash on startup.
I don't know how you would go about profiling an Android application, but I guess there must be some tools for this?
var FrameCount, TC1, TC2: Cardinal;procedure TFormGradientLines.Timer1Timer(Sender: TObject);begin if FrameCount >= 10 then begin TC2 := GetTickCount; DebugLn(Format('FPS: %.3f', [1000000*FrameCount / (TC2 - TC1)])); FrameCount := 0; TC1 := GetTickCount; end; Inc(FrameCount);end;
public void run() { int eventResult = LCLOnTimer(this); ProcessEventResult(eventResult); if (this.Destroyed == false) LocalHandler.postDelayed(this, lcltimerinterval); }
public void ProcessEventResult(int eventResult) { if (((eventResult | 1) != 0) && (lclsurface != null)) lclsurface.postInvalidate(); //if ((eventResult | 2) != 0) reserved for BACK key handling }
public void LCLDoCreateTimer() { lcltimerid = new LCLRunnable(); LocalHandler.removeCallbacks(lcltimerid); LocalHandler.postDelayed(lcltimerid, lcltimerinterval); };
Ops, rethinking now I think I used the wrong operator =) I think it should have been: if (((eventResult & 1) != 0) && (lclsurface != null)) lclsurface.postInvalidate();Could you try that line like that?