Closed
Bug 15810
Opened 26 years ago
Closed 26 years ago
[Perf] PR_Sync is called when you close a read-only file
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
RESOLVED
FIXED
M11
People
(Reporter: sfraser_bugs, Assigned: sfraser_bugs)
Details
FileImpl doesn't seem to be optimized for read-only files; it allocates an
mOutputbuffer, even if the file is opened in PR_RDONLY mode.
But a larger problem is that it calls Flush(), which calls PR_Sync, even if the
file is read-only. This will cause a lot more disk-rattling than is necessary.
| Assignee | ||
Updated•26 years ago
|
Summary: PR_Sync is called when you close a read-only file → [Perf] PR_Sync is called when you close a read-only file
| Assignee | ||
Comment 1•26 years ago
|
||
Here's a diff for the flush fix:
Index: nsIFileStream.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsIFileStream.cpp,v
retrieving revision 3.26
diff -r3.26 nsIFileStream.cpp
388c388,389
< Flush();
---
> if (mNSPRMode & PR_RDONLY)
> Flush();
| Assignee | ||
Comment 2•26 years ago
|
||
Since we can't tell in the ctor whether the FileImp will be used in read or write
mode, I suggest we allocate the buffers lazily when we know we're writing.
| Assignee | ||
Comment 3•26 years ago
|
||
Sorry that diff was wrong. Try this:
Index: nsIFileStream.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/io/nsIFileStream.cpp,v
retrieving revision 3.26
diff -r3.26 nsIFileStream.cpp
388c388,389
< Flush();
---
> if ((mNSPRMode & PR_RDONLY) == 0)
> Flush();
Comment 4•26 years ago
|
||
finders keeper. can you check this diff in?
| Assignee | ||
Updated•26 years ago
|
Assignee: dougt → sfraser
| Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 5•26 years ago
|
||
Fix in hand.
Updated•26 years ago
|
Target Milestone: M11
Comment 6•26 years ago
|
||
since Simon has fix in hand, setting to M11
| Assignee | ||
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 7•26 years ago
|
||
Fixed was checked in way back when.
*** Bug 209650 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•