FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Multithreading
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Multithreading
Posted: Tue May 28, 2013 10:20 AM
Antonio,

Antonio Linares wrote:Enrico,

How many records you have on the DBF ?


About 75000 records.

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Multithreading
Posted: Tue May 28, 2013 10:56 AM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Multithreading
Posted: Tue May 28, 2013 11:05 AM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Multithreading
Posted: Tue May 28, 2013 11:13 AM
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Multithreading
Posted: Tue May 28, 2013 01:07 PM

Enrico,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Multithreading
Posted: Tue May 28, 2013 02:33 PM

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.

Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Multithreading
Posted: Tue May 28, 2013 04:49 PM

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.

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Multithreading
Posted: Tue May 28, 2013 05:23 PM
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Multithreading
Posted: Tue May 28, 2013 06:47 PM

Enrico,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Multithreading
Posted: Tue May 28, 2013 07:51 PM
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
Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: Multithreading
Posted: Wed May 29, 2013 03:45 PM

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.

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Multithreading
Posted: Wed May 29, 2013 05:03 PM
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
Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: Multithreading
Posted: Thu May 30, 2013 08:13 AM

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).

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Multithreading
Posted: Thu May 30, 2013 08:20 AM
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
Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: Multithreading
Posted: Thu May 30, 2013 08:27 AM
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.