Closed nicksay closed 9 years ago
Chrome and Firefox support setting responseType = "json" on XMLHttpRequest objects: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties
responseType = "json"
This allows the browser to parse JSON on a separate thread before returning. Since every request always does a full parse for error-handling (https://github.com/youtube/spfjs/blob/b3c4f07e99f9c5d62f9f3ec59f86c52302edd549/src/client/nav/request.js#L350) using the value provided by responseType = "json" may reduce main thread contention slightly.
This is primarily a concern when loading very large responses.
Investigated this a little more:
Positive
Negative
xhr.response
null
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 (https://github.com/youtube/spfjs/blob/b3c4f07e99f9c5d62f9f3ec59f86c52302edd549/src/client/nav/request.js#L350) using the value provided by
responseType = "json"
may reduce main thread contention slightly.This is primarily a concern when loading very large responses.