Forum > Linux

Help Raspberry PI Lazarus Is Slow

(1/2) > >>

HarryCover:
Hello everyone

I get closer to you to find a solution, I wrote a program that recovered a record via Socket with 700 character divided as follows

350 Char corresponding to my text
and 350 CharColor corresponding to the color of my Char
all in 2 tables MonChar and CharColor

each character must be written in a Label of 1 characters (so in total my sheet at 350 Label)

so in my timer here is my code
i use TidClient to recev Record and after i use BytesTo1Raw(RecvBuf, pMonRecord, Sizeof TMonRecord));

Label1.caption:= pMonRecord.MonChar [0] [0].text; Label1.font.Color:= MyColor (pMonRecord.CharColor [0] [0] .text

This line is written 350 times implement up to 350 Label of course and according to the Char of my record also

So, the function code perfectly,

But the problem is that my timer is set to 15ms and the processing of this procedure takes 6 seconds before being displayed
for info I test in a same problem Thread

I have a Raspberry PI3 with a class 10 SD card and Debian

Do you have a solution so that the processing of this procedure can be faster

Sorry i'm a french and i use Google traduction

cordially

Harry

engkin:
You are using the wrong control (TLabel) for this application, because every time you change the Text or Font.Color of any TLabel a message is sent to repaint the underlying form parent control (usually the form). In your example that is 700 times.

Find a different approach.

Edit:
Try to lock the form.canvas before updating the labels and unlock it when done.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  form1.Canvas.LockCanvas;....update lablels  form1.Canvas.UnlockCanvas;

HarryCover:
Thank you for your help, I will test your proposal tomorrow. I'll tell you if it worked

cordially

Harry

HarryCover:
Hello and thank you for your help

Actually now the display is a little faster, 2s but not enough yet, the ping on both sides is 5 to 14 ms, is that the thread writing is the same as Windows and Delphi for Arm processors

cordially

Harry

engkin:
The key is to find a better method. For instance, hide all the labels (Visible := False) and use them just for their location in the OnPaint event of the form:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormPaint(Sender: TObject);begin  Canvas.Brush.Style:=bsClear;   Canvas.Font.Color := MyColor(pMonRecord.CharColor[0][0].text);  Canvas.TextOut(Label1.Left, Label1.Top, pMonRecord.MonChar[0][0].text);

Navigation

[0] Message Index

[#] Next page

Go to full version