Open Bug 1363772 (photon-perf-spec-connect) Opened 2 years ago Updated 21 days ago

[meta] Photon - Speculatively open network connections as soon as possible when we know the intended site destination.

Categories

(Firefox :: General, enhancement)

enhancement
Not set

Tracking

()

People

(Reporter: jj.evelyn, Unassigned)

References

(Depends on 3 open bugs, Blocks 1 open bug)

Details

(Keywords: meta, Whiteboard: [fxperf:meta])

This is a meta bug to track performance work in this area.

When the user interacts with some UI components(listed below), we can (for example) listen to mousedown event and set up speculative connections to speed up the load time of potential page opens.

UI buttons/components that might be able to apply this tricks are:

* Drop down menu on AwesomeBar
* type on AwesomeBar with autocomplete
* Back button (if no bfcache)
* Forward button (if no bfcache)
* Bookmarks items
* Refresh button
* Home button
* History items
* New Tab / Activity Stream
* Hover on unrestored background tabs


We need a general solution and tests to ensure coverage.
No longer depends on: photon-perf-menus
Depends on: 795303
Depends on: 808104
Depends on: 1355443
Depends on: 1348275
Depends on: 1355451
Depends on: 1355460
Depends on: 1348278
Flags: qe-verify-
Summary: Speculatively open network connections as soon as possible when we know the intended site destination. → [meta] Photon - Speculatively open network connections as soon as possible when we know the intended site destination.
Depends on: 1126785
Depends on: 874533
Follow-up to Bug 1348278: 

Currently, Gecko starts a speculative connect once the mousedown event is fired.

The question is how this works on touch-enabled devices. Should this also be done for touchstart/touchend (though that may be more like "hover" than "mousedown")? Looking at https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent#Event_order, the mousedown event is fired after touch events (assuming no touchcancel is happening). Should Fx do something more here or is this going to be too complex to handle all the different cases and situations?

Also, speculative connect is triggered by right-click as well. Regarding privacy, this may not be what you want, i.e. a user may want to right-click and e.g. copy the link or text and not want to open a connection to this server. Would it make sense to bypass the speculative connect for right-click? If yes, you may want to think about doing a speculative connect when specific items in the context menu are mousedown-ed (i.e. Open Link in new tab/window/... and "Search X for ...").
Flags: needinfo?(philipp)
Flags: needinfo?(cpeterson)
(In reply to Florian Bender from comment #1)
> Follow-up to Bug 1348278: 
> 
> Currently, Gecko starts a speculative connect once the mousedown event is
> fired.
> 
> The question is how this works on touch-enabled devices. Should this also be
> done for touchstart/touchend (though that may be more like "hover" than
> "mousedown")? Looking at
> https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/
> Supporting_both_TouchEvent_and_MouseEvent#Event_order, the mousedown event
> is fired after touch events (assuming no touchcancel is happening). Should
> Fx do something more here or is this going to be too complex to handle all
> the different cases and situations?
>

As I know, touchevent is not in the scope. And yeah it's more complicated, so it might not be worth it.

> Also, speculative connect is triggered by right-click as well. Regarding
> privacy, this may not be what you want, i.e. a user may want to right-click
> and e.g. copy the link or text and not want to open a connection to this
> server. Would it make sense to bypass the speculative connect for
> right-click? If yes, you may want to think about doing a speculative connect
> when specific items in the context menu are mousedown-ed (i.e. Open Link in
> new tab/window/... and "Search X for ...").

I don't think we speculative connect for right-click cases. The patch on Bug 1348278 will only take effects on `eLeftButton` click, and the rest of Firefox UI code we added also excluded mouse right clicks. Did I miss something?
(In reply to Evelyn Hung [:evelyn] from comment #2)
> I don't think we speculative connect for right-click cases. The patch on Bug
> 1348278 will only take effects on `eLeftButton` click, and the rest of
> Firefox UI code we added also excluded mouse right clicks. Did I miss
> something?

Ah looks like I missed that part in the function. But pre-connect will still be triggered for Strg/Shift + Click, right? Would it make sense then to also speculatively connect for middle click (open in new background tab) or is this covered by something else (e.g. pre-connect while UI opens tab)?
Evelyn and Philipp are the right people to make these decisions, but I agree that speculatively connecting on touchstart, Shift+Click, and middle mouse click all seem reasonable. These seem like less common use cases, so fixing them might be a lower priority.
Flags: needinfo?(cpeterson)
Shift+Click and middle mouse click open the link in a new background tab. An argument against speculatively connecting on for background tabs is that the user probably doesn't intend to open the background tab immediately. Speculatively connecting for a background tab link might slow down the current page the user is actually viewing.
(In reply to Chris Peterson [:cpeterson] from comment #4)
> Evelyn and Philipp are the right people to make these decisions, but I agree
> that speculatively connecting on touchstart, Shift+Click, and middle mouse
> click all seem reasonable. These seem like less common use cases, so fixing
> them might be a lower priority.

Yes to all of that :)
Flags: needinfo?(philipp)
Whiteboard: [fxperf]
Whiteboard: [fxperf] → [fxperf:meta]
You need to log in before you can comment on or make changes to this bug.