Closed Bug 1068888 Opened 11 years ago Closed 11 years ago

[Rocketbar] Defer saving of place until loadend

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.1 S5 (26sep)

People

(Reporter: kgrandon, Assigned: kgrandon)

References

Details

(Keywords: perf, regression, Whiteboard: [systemsfe])

Attachments

(1 file)

Spinning this off of bug 1050510 because it seems like it may be a slightly different issue, but contributing to the CPU usage we're seeing there.
Attached file Github pull request
Dale - what do you think of something like this?
Attachment #8490997 - Flags: review?(dale)
Comment on attachment 8490997 [details] [review] Github pull request I do agree we should debounce the changes, for example getting a bunch of icon definitions in at the same time However there are a few problems doing it this way, first in places is a singleton so any reference to local state is going to need to worry about what url the event is being referred to |this._currentPlaceEdits| when switching between apps. Another is that we cant just write things on loadend, its pretty trivial to write a website that wont ever trigger a loadend event (guardian.co.uk for example), also dealing with this in https://bugzilla.mozilla.org/show_bug.cgi?id=1064920
Attachment #8490997 - Flags: review?(dale) → review-
Seems like we should make a URL mapping then, and potentially store multiple records locally. Also what we can do is perform a setTimeout in addition to the loadend. So, basically store multiple records, save either onTimeout after locationchange, or loadend. I think this is potentially fine, until we have an evangelism or platform fix here. What do you think Dale, would you be ok with this approach?
Yup I think that approach would work good
Comment on attachment 8490997 [details] [review] Github pull request Dale - I've updated this to save after a timeout or load end event. It also handles multiple places. What do you think?
Attachment #8490997 - Flags: review- → review?(dale)
Comment on attachment 8490997 [details] [review] Github pull request This looks good, I do think we want to be more careful about not losing data though, we can get rid of |defaultPlace()| and only merge the keys which we have set is likely the cleanest way, but up to you, going to need some tests to make sure we dont overwrite / lose places data as well I think since it can be tricky / easy to miss
Attachment #8490997 - Flags: review?(dale)
Sounds good. The unit test will probably be something like, receive a titlechange after a loadend event, and verify we eventually save that as well. Working on this now.
Comment on attachment 8490997 [details] [review] Github pull request Hey Dale - hopefully we're getting closer, thanks for the reviews. I've put the updates into a separate commit for ease of review. This adds some tests to ensure we don't lose data and hit the debouces. This can now store multiple concurrent debounces as well for different URLs as well. Let me know what you think.
Attachment #8490997 - Flags: review?(dale)
Comment on attachment 8490997 [details] [review] Github pull request This is looking good and working well for me, I commented on github I think theres another null check needed before landing, but rest looks good, thanks
Attachment #8490997 - Flags: review?(dale) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment on attachment 8490997 [details] [review] Github pull request I would like to see this uplifted to 2.1 for performance improvements. [Approval Request Comment] [Bug caused by] (feature/regressing bug #): Feature implementation. [User impact] if declined: Worse performance than if we take it. [Testing completed]: Manual and unit testing. [Risk to taking this patch] (and alternatives if risky): Contained to system browser history, so should be relatively low risk. [String changes made]: No.
Attachment #8490997 - Flags: approval-gaia-v2.1?(fabrice)
Whiteboard: [systemsfe]
Target Milestone: --- → 2.1 S5 (26sep)
(In reply to Kevin Grandon :kgrandon from comment #11) > Comment on attachment 8490997 [details] [review] > Github pull request > > I would like to see this uplifted to 2.1 for performance improvements. > > [Approval Request Comment] > [Bug caused by] (feature/regressing bug #): Feature implementation. > [User impact] if declined: Worse performance than if we take it. For sure I would not approve if you said that this regressed performance ;) What is the gain here? 1% ? 10%? of what?
(In reply to Fabrice Desré [:fabrice] from comment #12) > For sure I would not approve if you said that this regressed performance ;) > What is the gain here? 1% ? 10%? of what? It depends on what kind of browser events the site was generating, so it's hard to give concrete performance numbers here. Before on average we were probably hitting datastore ~6-7 times per site load, now we should generally just hit it once. There is a profile in bug 1050510 comment 29 which shows each editPlace taking around ~15ms. If we save ~5 places.js calls per page load, then we save 60ms of CPU time per page load.
Comment on attachment 8490997 [details] [review] Github pull request Not bad enough to uplift.
Attachment #8490997 - Flags: approval-gaia-v2.1?(fabrice) → approval-gaia-v2.1-
(In reply to Fabrice Desré [:fabrice] from comment #14) > Comment on attachment 8490997 [details] [review] > Github pull request > > Not bad enough to uplift. Humm, 60ms per page load seems pretty awful to me - and this is probably the biggest perf improvement we could make right now. It also could be considered a perf regression. If it turns out that we do get any blockers, or bug 1050510 becomes blocking, then we should reconsider uplift.
Keywords: perf, regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: