Recent

Author Topic: String Processing CPU Speed and Large Data Sets  (Read 4161 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: String Processing CPU Speed and Large Data Sets
« Reply #15 on: December 14, 2018, 08:19:34 pm »
@lucamar

Because I don't understand how Application.ProcessMessages work or what it dose exactly I don't know whick method to use or how to choose.

It working fine right now. I don't want to close or exit the program just get out of the tight loop which appears to the user to a  not responding situation.

I'm about to start writing code for a process that will take info from one listbox and search for a match in another listbox with 8,600 items.

 I assume I have to code Application.ProcessMessages inside the loop for this process.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: String Processing CPU Speed and Large Data Sets
« Reply #16 on: December 15, 2018, 01:47:04 am »
You don't need that NeedToExit field; you can use this:

Code: Pascal  [Select][+][-]
  1.     if i mod 100=0 then
  2.     begin
  3.       Caption := i.ToString;
  4.       Application.ProcessMessages;
  5.       if Application.Terminated then
  6.         exit;

That will take care of stopping if the user tries to close application.
That's even better. And JLWest does not need to use OnCloseQuery, as well.

 

TinyPortal © 2005-2018