The need for speed

jda jda at his.com
Tue Nov 27 08:28:14 CST 2007


Hi Ruslan,

I'm hoping there are some tricks you can tell me that will speed up a 
function I am implementing.

Basically, it is a sync between two databases. One is on a server 
(remote) and one is local. Here is the basic schema:

1. Open local and remote dbs.
2. Compare records and see which need syncing.
3. Close remote db.
4. Present use with a dialog asking if the sync should proceed.
5. If yes, reopen remote db and do updates.
6. Close remote db.

It's pretty fast except steps #3 and #6, which are very slow if I use 
broadband and a server like .Mac (up to 100 seconds to close the db). 
So the sync takes an extra 3.3 minutes just to close the remote db! 
(BTW, I close it after step 3 so that another user might sync to the 
same db while the person is deciding what to do when the dialog is 
put up).

This is, I'm guessing, due to an implicit db.flush when the db is 
closed. But in step #3 there is no need for this, because I'm not 
updating the db, just doing readonly searches.

Also, in step #6 there may be no need to flush the remote db if the 
records only change in the local db.

So what I'm asking is:

1. Is there a way to avoid the db.flush when a db is closed? If not, 
can this be implemented as a feature request (e.g. 
db.closeWithoutFlush).

2. Is there some other trick I'm missing with regard to speeding up 
this process?

Thanks,

Jon


More information about the Valentina mailing list