Closed Bug 1223420 Opened 9 years ago Closed 9 years ago

Avoid creating intermediate array in DataAdapter update functions for history and bookmarks

Categories

(Firefox OS Graveyard :: Sync, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mbdejong, Unassigned)

Details

Attachments

(1 file)

The current DataAdapters for history and bookmarks have an update function which calls an _update function which loops over the Kinto collection to fill an array. This array is then passed to HistoryHelper.updatePlaces or BookmarksHelper.updateBookmarks, and is looped over a second time in order to make the necessary changes in the DataStore for each record.

Creating this array and then looping over essentially the same records a second time is probably not very memory-efficient (and probably also not so time-efficient).
Attachment #8686088 - Flags: review?(ferjmoreno)
Attachment #8686088 - Flags: feedback?(selee)
Attachment #8686088 - Flags: review?(ferjmoreno) → review?(selee)
Comment on attachment 8686088 [details] [review]
[gaia] michielbdejong:1223420-avoid-intermediate-array > mozilla-b2g:master

Hi Michiel, Could you rebase the patch to master branch? That would be easier to review and test your patch. Thank you! :)
Attachment #8686088 - Flags: review?(selee)
Attachment #8686088 - Flags: review-
Attachment #8686088 - Flags: feedback?(selee)
OK! Rebased.
Flags: needinfo?(selee)
Attachment #8686088 - Flags: review- → review?(selee)
Comment on attachment 8686088 [details] [review]
[gaia] michielbdejong:1223420-avoid-intermediate-array > mozilla-b2g:master

Hi Michiel, Thanks for doing this refactor and LGTM :)
I leave one minor question about the test context.
Flags: needinfo?(selee)
Attachment #8686088 - Flags: review?(selee) → review+
Thanks!!
Rebased and edited r=.
Flags: needinfo?(selee)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: