Closed
Bug 828281
Opened 11 years ago
Closed 11 years ago
UpdateRecord in CloseOutputStream can be removed
Categories
(Core :: Networking: Cache, defect)
Core
Networking: Cache
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: alfredkayser, Assigned: alfredkayser)
Details
(Keywords: memory-footprint, perf)
Attachments
(1 file, 1 obsolete file)
3.63 KB,
patch
|
Details | Diff | Splinter Review |
This is the line in nsDiskCacheStream.cpp 514 // XXX do we need this here? WriteDataCacheBlocks() calls UpdateRecord() As the buffering logic has been simplified, the flush either writes data to the cacheblocks, which also performs the UpdateRecord, or the file which then calls UpdateFileSize, which calls UpdateRecord. UpdateRecord is not a light function, and calls InvalidateCache(), etc...
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → alfredkayser
Assignee | ||
Comment 1•11 years ago
|
||
UpdateRecord is not needed when calling WriteDataCacheBlocks, but it is needed when there is no data (mStreamEnd==0), so only call UpdateRecord in that scenario. Furthermore structure the code to follow the logic: 1. if writing to file, close file and return else the stream is small enough to fit in blocks storage. 3. delete any old storage (file or blocks) 4.
Assignee | ||
Comment 2•11 years ago
|
||
UpdateRecord is not needed when calling WriteDataCacheBlocks, but it is needed when there is no data (mStreamEnd==0), so only call UpdateRecord in that scenario. Furthermore structure the code to follow the logic: 1. if writing to file, close file and return else the stream is small enough to fit in blocks storage.: 2. delete any old storage (file or blocks) 3. if no data, just update record and return 4. write to blocks 5. if failed, flush to file. Overall effect is that UpdateRecord is not called twice when writing to blocks (when that fails, flushing to file). UpdateRecord triggers InvalidateCache, which performs a file write (of 1 byte) and setting a timer, so it is somewhat costly to call twice. tryserver is running: https://tbpl.mozilla.org/?tree=Try&rev=842d8a7d1901
Comment 3•11 years ago
|
||
Try run for 842d8a7d1901 is complete. Detailed breakdown of the results available here: https://tbpl.mozilla.org/?tree=Try&rev=842d8a7d1901 Results (out of 229 total builds): exception: 5 success: 199 warnings: 24 failure: 1 Builds (or logs if builds failed) available at: http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/alfredkayser@gmail.com-842d8a7d1901
Assignee | ||
Updated•11 years ago
|
Attachment #700247 -
Flags: review?(michal.novotny)
Comment 4•11 years ago
|
||
Comment on attachment 700247 [details] [diff] [review] Patch to only call UpdateRecord when needed Looks good, r+ with following nits fixed: > + nsresult rv = cacheMap->DeleteStorage(record, nsDiskCache::kData); There are 3 declaration of rv. Do it only once at the beginning of the method. > - NS_WARNING("cacheMap->UpdateRecord() failed."); > - return rv; // XXX doom cache entry You've moved the code without the comment. Either keep the comment, or check what exactly happens in case of failure and whether we should or shouldn't doom the entry.
Attachment #700247 -
Flags: review?(michal.novotny) → review+
Assignee | ||
Comment 5•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=f0ebade21120
Attachment #700247 -
Attachment is obsolete: true
Assignee | ||
Comment 6•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=4fe38a0ee8c5
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/4fe38a0ee8c5
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in
before you can comment on or make changes to this bug.
Description
•