-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use XHR2 responseType = "json"
when possible
#317
Labels
Milestone
Comments
Investigated this a little more: Positive
Negative
|
nicksay
added a commit
to nicksay/spfjs
that referenced
this issue
Apr 13, 2015
Add support for setting the XHR `responseType` property to `"json"`. This defines the response data as JSON and prevents the browser from handling other types of data. It allows JSON parsing to be done off of the main thread, reducing CPU contention that can happen with large responses and low-power devices; this can yield smoother animations during navigation, for example. However, it prevents processing chunked responses on-the-fly (i.e. pseudo-streaming), effectively eliminating most of the benefits of multipart responses. Guard this behavior behind an "advanced" config flag and provide no default to prevent accidental usage. Setting `advanced-response-type-json` to `true` will enable the feature. Closes youtube#317.
nicksay
added a commit
to nicksay/spfjs
that referenced
this issue
Apr 13, 2015
Add support for setting the XHR `responseType` property to `"json"`. This defines the response data as JSON and prevents the browser from handling other types of data. It allows JSON parsing to be done off of the main thread, reducing CPU contention that can happen with large responses and low-power devices; this can yield smoother animations during navigation, for example. However, it prevents processing chunked responses on-the-fly (i.e. pseudo-streaming), effectively eliminating most of the benefits of multipart responses. Guard this behavior behind an "advanced" config flag and provide no default to prevent accidental usage. Setting `advanced-response-type-json` to `true` will enable the feature. Closes youtube#317.
nicksay
added a commit
to nicksay/spfjs
that referenced
this issue
Apr 14, 2015
nicksay
added a commit
to nicksay/spfjs
that referenced
this issue
Apr 14, 2015
Add support for setting the XHR `responseType` property to `"json"`. This defines the response data as JSON and prevents the browser from handling other types of data. It allows JSON parsing to be done off of the main thread, reducing CPU contention that can happen with large responses and low-power devices; this can yield smoother animations during navigation, for example. However, it prevents processing chunked responses on-the-fly (i.e. pseudo-streaming), effectively eliminating most of the benefits of multipart responses. Guard this behavior behind an "advanced" config flag and provide no default to prevent accidental usage. Setting `advanced-response-type-json` to `true` will enable the feature. Closes youtube#317.
nicksay
added a commit
to nicksay/spfjs
that referenced
this issue
Apr 16, 2015
Add support for setting the XHR `responseType` property to `"json"`. This defines the response data as JSON and prevents the browser from handling other types of data. It allows JSON parsing to be done off of the main thread, reducing CPU contention that can happen with large responses and low-power devices; this can yield smoother animations during navigation, for example. However, it prevents processing chunked responses on-the-fly (i.e. pseudo-streaming), effectively eliminating most of the benefits of multipart responses. Guard this behavior behind an "advanced" config flag and provide no default to prevent accidental usage. Setting `advanced-response-type-json` to `true` will enable the feature. Closes youtube#317.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Chrome and Firefox support setting
responseType = "json"
on XMLHttpRequest objects: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#PropertiesThis allows the browser to parse JSON on a separate thread before returning. Since every request always does a full parse for error-handling (
spfjs/src/client/nav/request.js
Line 350 in b3c4f07
responseType = "json"
may reduce main thread contention slightly.This is primarily a concern when loading very large responses.
The text was updated successfully, but these errors were encountered: