Page 2 of 3

Re: Multithreading

PostPosted: Tue May 28, 2013 10:20 am
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:Enrico,

How many records you have on the DBF ?


About 75000 records.

EMG

Re: Multithreading

PostPosted: Tue May 28, 2013 10:56 am
by Antonio Linares
Enrico,

I created a 80.000 records DBF (using dbcre8.exe) and tested it with Harbour:

ST: 0,299 secs

MT: 0,345 secs

You are right, MT apps are slower :-(

I am reporting it to the Harbour dev group:
https://groups.google.com/forum/?fromgr ... Ap9qFn9gSs

Re: Multithreading

PostPosted: Tue May 28, 2013 11:05 am
by anserkk
StefanHaupt wrote:Enrico,

just to understand, what could be the advantages using MT instead of ST ? What functions could be put in threads ?

Im my understanding a database application is a single thread application with single tasks, e.g. browsing a dbf or searching in a dbf. What can be done, to get simultaneous tasks ?

Stefan


It may be good to have your program to check in the background via a thread for an updated version of your exe on some servers, that too without delaying/pausing/interfering the work of your user on the application. If an updated version is available then it would show a popup message that a new version of the app is available, else nothing happens, the user continues with his work.

Without a thread, the same can be done when the user starts the app, the program will do a check on some server for an updated version and then inform the user about the updated version. But the problem here, is that, the user will have to wait until the checking process is completed. In other words the user's activity is paused for some time and he will have to wait.

There are many other possibilities of using multi threading in your application.

Regards
Anser

Re: Multithreading

PostPosted: Tue May 28, 2013 11:13 am
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,

I created a 80.000 records DBF (using dbcre8.exe) and tested it with Harbour:

ST: 0,299 secs

MT: 0,345 secs

You are right, MT apps are slower :-(

I am reporting it to the Harbour dev group:
https://groups.google.com/forum/?fromgr ... Ap9qFn9gSs


Thank you, Master!

EMG

Re: Multithreading

PostPosted: Tue May 28, 2013 1:07 pm
by Antonio Linares
Enrico,

Mindaugas just answered. his explanation sounds logical, but nobody would want to slow down his app...

Re: Multithreading

PostPosted: Tue May 28, 2013 2:33 pm
by hmpaquito
Hi all,

Well, I think that (x)harbour applications are super fast. So if the multithreading makes them lose a little speed to my unimportant. The multithreading can bring many good features to our applications.

My two (euro) cents.

Re: Multithreading

PostPosted: Tue May 28, 2013 4:49 pm
by sambomb
Some good uses for MT exe:
Index multiple files simultaneously.
Open non modal dialogs in different threads.
Run long tasks with multiple theads, 1 just for the dialog management and as many as possible for the other tasks.

Obviously, MT exe only will be faster in functions that use multiple threads in multi nuclear processors.

Re: Multithreading

PostPosted: Tue May 28, 2013 5:23 pm
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:Enrico,

Mindaugas just answered. his explanation sounds logical, but nobody would want to slow down his app...


Thank you. :-(

I give up with multithreading. xHarbour's background tasks are much more efficient, despite what Harbour developers can say...

EMG

Re: Multithreading

PostPosted: Tue May 28, 2013 6:47 pm
by Antonio Linares
Enrico,

Have you checked, when you use a background task, if the app speed decrease ?

Re: Multithreading

PostPosted: Tue May 28, 2013 7:51 pm
by Enrico Maria Giordano
Antonio,

Antonio Linares wrote:Enrico,

Have you checked, when you use a background task, if the app speed decrease ?


Yes. Of course, it depends on what the background task is doing. If it is activated but is doing nothing (ie. is executing an empty codeblock) then the app speed doesn't decrease.

EMG

Re: Multithreading

PostPosted: Wed May 29, 2013 3:45 pm
by Patrizio
Enrico, Antonio: a test of that kind don't make sense in MT.

Try to make multiple scans of the same dbf file: one after the other in ST, parallel to each other in MT.

Re: Multithreading

PostPosted: Wed May 29, 2013 5:03 pm
by Enrico Maria Giordano
Patrizio,

Patrizio wrote:Enrico, Antonio: a test of that kind don't make sense in MT.


The sense is that my application will slow down if I only link the MT libs in. Unacceptable for me.

EMG

Re: Multithreading

PostPosted: Thu May 30, 2013 8:13 am
by Patrizio
Enrico, the error is considered an application MT as an application ST with an extra function.

MT applications are designed especially for parallel processes (we use .NET MT app for processing many ascii files at same time).

Re: Multithreading

PostPosted: Thu May 30, 2013 8:20 am
by Enrico Maria Giordano
Patrizio,

Patrizio wrote:Enrico, the error is considered an application MT as an application ST with an extra function.

MT applications are designed especially for parallel processes (we use .NET MT app for processing many ascii files at same time).


That's why I prefer background tasks. :-)

EMG

Re: Multithreading

PostPosted: Thu May 30, 2013 8:27 am
by Patrizio
Enrico Maria Giordano wrote:Patrizio,

That's why I prefer background tasks. :-)

EMG


It depends on what you need to do, I use bgtasks to check if there is connectivity and check for sw updates.