Closed Bug 287827 Opened 20 years ago Closed 20 years ago

nsLocalFile::MoveTo is very slow to move directories

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 231300

People

(Reporter: darin.moz, Assigned: dougt)

Details

(Keywords: perf)

nsLocalFile::MoveTo is very slow to move directories

when the disk cache is forced to flush the disk cache, it first moves the Cache
folder into the Cache.Trash folder.  this operation is very expensive.  it seems
that the problem is that the CopyMove method chooses to iterate the source
directory and move individual files instead of moving the entire directory with
one system call.

the Win32 MoveFile system call works on directories, so it seems that it should
be possible to fix this performance problem easily.

on my T41 notebook (w/ fast harddrive) it takes about 3 seconds to clear a 50 Mb
disk cache.  on other systems, i've seen this process take up to 10 seconds or
more.  it makes firefox appear as though it has failed to start.

this problem does not exist under linux because we first try to rename the
directory on that platform, which is a fast operation.  we should implement the
same algorithm for windows.
So, with some hacking I verified that this can indeed be resolved by using
MoveFile on directories.  Doing so basically eliminates all overhead associated
with moving the Cache into the Cache.Trash folder.  I think this would be a good
bug to fix, but nsLocalFileWin.cpp scares me! ;-)
The one caveat is that the MoveFile function will fail on directory moves when
the destination is on a different volume.
Looks very similiar to Bug 231300.
Thanks.  I figured this bug must be on file somewhere, but I couldn't find it.

*** This bug has been marked as a duplicate of 231300 ***
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.