![](smile.gif)
remove(); too slow?!
Yah, the int remove( const char *path ); function... The point is that I need to navigate thru a +23.000 files directory and compare each file''s last modification date one by one and delete it if necessary.
The search & compare method is very fast (I think
), it takes 16secs to do all the job. But whenever I add that single damn remove(__filetodel); (assume __filetodel is a valid pointer to a char filename) line, it takes ~10mins to delete ~60% of the files.
I tried doing a del *.* from DOS and it just takes 8segs!!! What is wrong with remove();????
I thought of making all the delete stuff in ASM but I don''t know anything about ASM and I don''t know how to attach already-made sources to Visual C++!
Please, help me because there is no sense here...
![](smile.gif)
I have a feeling that remove calls DeleteFile() internally (depending on what C Runtime you are using) but you can try replacing remove(const char*) with DeleteFile(LPCSTR pathname) and let me know if that helps...
P.S. What CRT, and compiler...
Dire Wolf
direwolf@digitalfiends.com
Dire Wolf
www.digitalfiends.com
P.S. What CRT, and compiler...
Dire Wolf
direwolf@digitalfiends.com
Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
Remember also that del *.* would probably use some special-case code to just remove the entry for that directory from the FAT and reinsert an empty one - that''s only two changes to the FAT. If it had to actually visit every single file, it''d be much slower as well.
War Worlds - A 3D Real-Time Strategy game in development.
War Worlds - A 3D Real-Time Strategy game in development.
I''m working on Visual C++ 6.0 SP5, I''m making it basically in C++ but since I''m a begginer/intermediate with C++ (and somewhat experienced in C), I still use C functions (just some functions).
I got 6mins using the DeleteFile(); API function, still tremendously slow taking in account a "del *.*" DOS function just takes 8secs, but much more acceptable (~40% faster)...
BTW, I mistook percents in the last message, it actually deletes 45% of the files, so,
del *.* = 8secs to delete 23434 files (1,5kb each one)
DeleteFile(); = 6mins to delete 8035 files (1,5kb each one)
My computer/soft specs are:
Microsoft Visual Studio Enterprise 6.0 w/SP5
Pentium 2 233Mhz 64mb pc100 RAM using a pre-historic UDMA33 HD
I got 6mins using the DeleteFile(); API function, still tremendously slow taking in account a "del *.*" DOS function just takes 8secs, but much more acceptable (~40% faster)...
BTW, I mistook percents in the last message, it actually deletes 45% of the files, so,
del *.* = 8secs to delete 23434 files (1,5kb each one)
DeleteFile(); = 6mins to delete 8035 files (1,5kb each one)
My computer/soft specs are:
Microsoft Visual Studio Enterprise 6.0 w/SP5
Pentium 2 233Mhz 64mb pc100 RAM using a pre-historic UDMA33 HD
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement