Copy File to USB slow??

Copy File to USB slow??

Postby Marc Vanzegbroeck » Wed Apr 05, 2006 8:25 am

Hello,

If I copy a file of 1.6Mb using COPY FILE to a USB-stick is takes 45seconds.
The same file to the local disk take only 0.05s!!!!

Is there an other function I can use to copy the file?

Thanks,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Antonio Linares » Wed Apr 05, 2006 8:40 am

Marc,

That uses to be a USB-stick hardware limitation, unless you get a faster one.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42149
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marc Vanzegbroeck » Wed Apr 05, 2006 9:19 am

Antonio,

If I copy it with explorer , it's much faster. I have also a routine that use fopen() and fwrite(), and this is also faster :roll:

Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Vladimir Grigoriev » Wed Apr 05, 2006 10:38 am

I don't remember exactly but COPY FILE (or strictly speaking the corresponding function from EXTEND.LIB) uses a small buffer. By using fread() and fwrite() you can define a buffer as large as the maximum Clipper virtual segment size i.e. 0FFECh.
Vladimir Grigoriev
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Postby Enrico Maria Giordano » Wed Apr 05, 2006 10:39 am

Try

COPYFILE( cSource, cDest )

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Vladimir Grigoriev » Wed Apr 05, 2006 11:19 am

Enrico, I thought that there is function __COPYFILE() in Clipper that is used in COPY FILE command.
Mentioned by you COPYFILE() function is a pure FiveWin function?
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Postby Marc Vanzegbroeck » Wed Apr 05, 2006 11:28 am

Enrico,
I can't find the copyfile() function.

Vladimir, I have tried it with the fread()/fwrite() functions.
It's much faster (4.7sec) than COPY FILE (45sec), but increasing the buffer doesn't help. It even makes it slower. With a buffer of 1024bytes it takes 4.7sec, a buffer of 20000bytes result in 11.5sec

Regards,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Vladimir Grigoriev » Wed Apr 05, 2006 11:43 am

It is very strange! As I know __COPYFILE() uses a buffer of size 1024 bytes also (or almost the same). The situation needs investigation. What does grab the time in this case?
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Postby Enrico Maria Giordano » Wed Apr 05, 2006 11:43 am

Code: Select all  Expand view  RUN
DLL32 FUNCTION COPYFILE( cExistingFileName AS LPSTR, cNewFileName AS LPSTR, lFailIfExists AS LONG ) AS BOOL;
      PASCAL FROM "CopyFileA" LIB "kernel32.dll"


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8719
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Marc Vanzegbroeck » Wed Apr 05, 2006 12:08 pm

Vladimir, With a buffer of 1024 it takes 4.5sec, With a buffer of 20000 it takes 11.(sec.

Enrico, I have tried the COPYFILE() it and it's faster. :D It takes 3.7sec to copy the file..


Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Vladimir Grigoriev » Wed Apr 05, 2006 12:20 pm

Vladimir, With a buffer of 1024 it takes 4.5sec, With a buffer of 20000 it takes 11.(sec.

I can explain this only the following way. Maybe your program uses a swap file for its virtual memory system. If you request a small block of memory then there is not any need to dwap memory on disk. If you request a large memory block a swap on disk occurs.
It is interesting do you use EMM memory? Try to use EMM memory for your Clipper program and check times anew.
As for Win API function FILECOPY() it does not use Clipper virtual memory. It allocates its own memory for copy operations. So it may be faster. On the other hand I don't know can you use ERROR object with WIN API FILECOPY() function? The Clipper function __FILECOPY() builds ERROR object inside itself.

Vladimir Grigoriev
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Postby Marc Vanzegbroeck » Wed Apr 05, 2006 12:37 pm

It is interesting do you use EMM memory? Try to use EMM memory for your Clipper program and check times anew.


Where do I specify this?

Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Vladimir Grigoriev » Wed Apr 05, 2006 12:45 pm

Open your program PROPERTIES by right mouse clicing on the shortcut. On a panel Memory (I am speaking about XP though the same should be in Win 98) there is a dropdown field Expanded (EMS) memory. Change its value from None to 8192.
Then enlarge your buffer, for example, from 1024 to 10240 and repeat testings. One for the 1024 buffer and another for the 10240 buffer.

Vladimir Grigoriev
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Postby Marc Vanzegbroeck » Wed Apr 05, 2006 1:00 pm

I'm using XP-professional SP2.
If I right-click the shortcut and open the properties, I can't see the memory panel. I only can check the 'run in separate memory' checkbox.

Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby Vladimir Grigoriev » Wed Apr 05, 2006 1:16 pm

O'k Marc. I was speaking about DOS program all this time :) but FiveWin program is a Windows program so shortcuts are different for this two types of programs.
Unfortunately I don't know what Virtual Memory Manager is used in FiveWin program. This question should be addressed to Antonio Linares.
Anyway you can write a simple DOS Clipper test program and perform the same operaions for the sake of interest. In this case you will be able to set on or set off EMS memory option on the corresponding shortcut.
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Next

Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 4 guests