Closed
Bug 386711
Opened 17 years ago
Closed 17 years ago
Use single queries in nsNavHistoryExpire methods
Categories
(Firefox :: Bookmarks & History, defect)
Firefox
Bookmarks & History
Tracking
()
VERIFIED
FIXED
Firefox 3 alpha8
People
(Reporter: mak, Assigned: mak)
References
Details
Attachments
(2 files, 3 obsolete files)
6.51 KB,
patch
|
dietrich
:
review+
|
Details | Diff | Splinter Review |
3.29 KB,
patch
|
dietrich
:
review+
|
Details | Diff | Splinter Review |
Actually the following functions use a for cycle, and make a select and a delete on each iteration (2 sql queries per iteration). That could be avoided creating a string with the list of IDs to delete and using a subquery. So instead of a for cycle made of queries we end up with a for cycle appending to a string and a single final query. functions are: nsNavHistoryExpire::EraseVisits nsNavHistoryExpire::EraseHistory nsNavHistoryExpire::EraseFavicons Also EraseAnnotations (not yet implemented) could use the same method I attach a patch to show the alternative method purposed, it should have less sqlite overhead cause it makes a single call insted of a call in every iteration. These are my first patches and i'm learning, so please doublecheck. I also need someone to checkin (if approved).
Assignee | ||
Comment 1•17 years ago
|
||
Assignee | ||
Updated•17 years ago
|
Summary: Use single queries on nsNavHistoryExpire → Use single queries in nsNavHistoryExpire methods
Updated•17 years ago
|
Assignee: mak77 → nobody
Status: ASSIGNED → NEW
Component: History → Places
QA Contact: history → places
Comment 2•17 years ago
|
||
Sorry for the delay here, Marco. Any reason why you re-assigned to nobody?
Assignee | ||
Comment 3•17 years ago
|
||
the re-assign has been made from Gavin sharp, i think he has his reasons (but don't know them)
Comment 4•17 years ago
|
||
Sorry, "re-assign to defaults" is selected automatically when you change components, and I forgot to unselect it.
Assignee: nobody → mak77
Assignee | ||
Updated•17 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•17 years ago
|
||
Comment on attachment 270712 [details] [diff] [review] Alternative method to do expire queries there is possible problem here. doing: IN (1,2,3) is different from doing: IN ("1,2,3") need to check how mozStorage handle deleteStatement->BindUTF8StringParameter the string should be simply added to the string and not parsed anyway
Attachment #270712 -
Flags: review?(sspitzer)
Assignee | ||
Updated•17 years ago
|
Attachment #270712 -
Attachment is obsolete: true
Assignee | ||
Comment 6•17 years ago
|
||
i've rewritten the patch following naming and formatting conventions from the Dietrich's Annotation Expiry patch of Bug 319455. it is now using ExecuteSimpleSQL instead of a useless statement, because it doesn't need anymore bindings. This does not compile against current Trunk because it uses the nsNavHistoryRecord pageID -> placeID fix of Bug 319455, so this should land immediately after, or i can create a patch with pageID but then Dietrich should correct functions to use placeID when he lands his patch. Or maybe the best could be merge this patch into his work.
Comment 7•17 years ago
|
||
thanks marco! let's keep this patch separate just to keep the patch in 319455 to a manageable size.
Assignee | ||
Comment 8•17 years ago
|
||
patch updated after landing of Dietrich's annotations patch i'd like if Dietrich could check this before asking review to Seth
Attachment #271507 -
Attachment is obsolete: true
Updated•17 years ago
|
Target Milestone: Firefox 3 M7 → Firefox 3 M8
Comment 9•17 years ago
|
||
Comment on attachment 274460 [details] [diff] [review] updated patch this looks good, thanks.
Attachment #274460 -
Flags: review+
Comment 10•17 years ago
|
||
Checking in toolkit/components/places/src/nsNavHistoryExpire.cpp; /cvsroot/mozilla/toolkit/components/places/src/nsNavHistoryExpire.cpp,v <-- nsNavHistoryExpire.cpp new revision: 1.12; previous revision: 1.11 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 11•17 years ago
|
||
It is hard to check without more thorough investigation but, if EraseHistory or EraseFavicons can ever end up with no deletions to check, this could add a query execution compared with the previous code - ... WHERE id IN () ... - in which case if (deletedPlaceIds.IsEmpty()) return NS_OK; may be a sensible early return.
Assignee | ||
Comment 12•17 years ago
|
||
followup patch, early returns as per previous comment (good catch)
Attachment #277695 -
Flags: review?(dietrich)
Assignee | ||
Comment 13•17 years ago
|
||
fixes some space too
Attachment #277695 -
Attachment is obsolete: true
Attachment #277697 -
Flags: review?(dietrich)
Attachment #277695 -
Flags: review?(dietrich)
Comment 14•17 years ago
|
||
Comment on attachment 277697 [details] [diff] [review] followup, early returns, fixes some space > // Do not add comma separator for the first entry >- if(! deletedFaviconIds.IsEmpty() ) >+ if (! deletedFaviconIds.IsEmpty() ) > deletedFaviconIds.AppendLiteral(", "); > deletedFaviconIds.AppendInt(aRecords[i].faviconID); > } > no need for the extra space at the close parens either actually, i'll remove them before checkin. r=me otherwise.
Attachment #277697 -
Flags: review?(dietrich) → review+
Comment 15•17 years ago
|
||
Checking in toolkit/components/places/src/nsNavHistoryExpire.cpp; /cvsroot/mozilla/toolkit/components/places/src/nsNavHistoryExpire.cpp,v <-- nsNavHistoryExpire.cpp new revision: 1.13; previous revision: 1.12 done
Comment 16•17 years ago
|
||
(In reply to comment #14) > (From update of attachment 277697 [details] [diff] [review]) > > // Do not add comma separator for the first entry > >- if(! deletedFaviconIds.IsEmpty() ) > >+ if (! deletedFaviconIds.IsEmpty() ) > > deletedFaviconIds.AppendLiteral(", "); > > deletedFaviconIds.AppendInt(aRecords[i].faviconID); > > } > > no need for the extra space at the close parens either actually, i'll remove > them before checkin. r=me otherwise. [Sorry I'm nit-picking after check-in] Presumably the space in ", " is just cosmetic as well. Probably not worth writing home about unless the lists can run to thousands of ids...
Comment 17•17 years ago
|
||
Verified, there are no more query-in-loop patterns in these methods.
Status: RESOLVED → VERIFIED
Comment 18•15 years ago
|
||
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h". In Thunderbird 3.0b, you do that as follows: Tools | Message Filters Make sure the correct account is selected. Click "New" Conditions: Body contains places-to-b-and-h Change the action to "Delete Message". Select "Manually Run" from the dropdown at the top. Click OK. Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter. Gerv
Component: Places → Bookmarks & History
QA Contact: places → bookmarks
You need to log in
before you can comment on or make changes to this bug.
Description
•