This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26759 - "Every 50ms or whenever response's body's is pus..."
Summary: "Every 50ms or whenever response's body's is pus..."
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: Fetch (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+fetchspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-08 23:32 UTC by Ian 'Hixie' Hickson
Modified: 2014-09-26 13:06 UTC (History)
5 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2014-09-08 23:32:36 UTC
http://fetch.spec.whatwg.org/#fetching

[[
Every 50ms or whenever response's body's is pushed to, whichever is least frequent and as long as response has no termination reason and end-of-file has not been pushed, queue a task to process response body for response.
]]

Why are we forcing there to be a 50ms lag here?
Comment 1 Anne 2014-09-09 09:15:04 UTC
We have the 50ms so progress events go at about 60Hz iirc.
Comment 2 Olli Pettay 2014-09-09 09:49:36 UTC
It is not 60Hz. That would require 16ms.

The lag is there to prevent totally hanging the task queue,
but I can't now recall where 50ms came from.
(I think some other feature in the platform used 50ms, but which one..)
Not having any limit was certainly an issue at some point.

Also, the lag is just for progress events, except the last one, so it
doesn't actually slow down loading the data or anything.
Comment 3 Takeshi Yoshino 2014-09-09 10:06:05 UTC
Discussion happened in July
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2014-July/297279.html

As Olli said, it affects only "progress" ProgressEvent dispatching.

This revision changed the frequency to 50ms from 350ms.
http://dev.w3.org/cvsweb/2006/webapi/XMLHttpRequest-2/Overview.src.html.diff?r1=1.43;r2=1.44;f=h

http://lists.w3.org/Archives/Public/public-webapps/2008OctDec/0111.html
Anne targeted 20fps.

http://lists.w3.org/Archives/Public/public-webapps/2008OctDec/0312.html
Olli agreed.
Comment 4 Simon Pieters 2014-09-09 11:46:54 UTC
If progress events are intended to drive style changes, maybe they should be synced with requestAnimationFrame? (No opinion on targeting 60fps vs 20fps here.)
Comment 5 Ian 'Hixie' Hickson 2014-09-17 22:33:00 UTC
I've no problem with events being throttled. But that's not what this is doing. This is throttling doing anything at all with the data.
Comment 6 Anne 2014-09-23 07:57:45 UTC
So I should queue plenty of tasks from Fetch and put the throttling in XMLHttpRequest.

The idea here was to align all dependencies of Fetch as to having the same throttling behavior. But perhaps that's not the best strategy. (Note that the actual underlying stream is not delayed. It's just the higher level notification mechanism.)

Okay?
Comment 7 Ian 'Hixie' Hickson 2014-09-24 21:01:03 UTC
I don't understand what you mean by "actual underlying stream" vs "higher level notification mechanism". I just mean the tasks that the "fetch" algorithm fires so that the data can be processed.
Comment 8 Anne 2014-09-25 08:06:00 UTC
When the first task is run on the thread that invoked Fetch, that thread has access to response's body which is a stream. That stream is being pushed to whenever new data arrives. The other tasks being queued give some additional information mostly relevant for progress events. And then a task in the end to say everything is over.
Comment 9 Ian 'Hixie' Hickson 2014-09-25 22:27:24 UTC
I don't understand. How should this stream be used? Are you expecting the stream user to do an in-parallel algorithm that fires a task to handle each byte, rather than fetch doing it like it used to in the HTML spec?
Comment 10 Anne 2014-09-26 08:37:01 UTC
It would go per chunk these days, not byte, but yeah, you're right, I should just put the throttling at a higher level.