Disable copyWithin Use in Websock.js
the `copyWithin` function of typed arrays has performance issues in some versions of Chromium, and doesn't doesn't have enough of a performance impact to justify leaving it enabled.
This commit is contained in:
parent
a0e7ab43dc
commit
c8f14d175b
|
@ -67,6 +67,11 @@ function Websock() {
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
// this has performance issues in some versions Chromium, and
|
||||||
|
// doesn't gain a tremendous amount of performance increase in Firefox
|
||||||
|
// at the moment. It may be valuable to turn it on in the future.
|
||||||
|
var ENABLE_COPYWITHIN = false;
|
||||||
|
|
||||||
var typedArrayToString = (function () {
|
var typedArrayToString = (function () {
|
||||||
// This is only for PhantomJS, which doesn't like apply-ing
|
// This is only for PhantomJS, which doesn't like apply-ing
|
||||||
// with Typed Arrays
|
// with Typed Arrays
|
||||||
|
@ -364,8 +369,7 @@ function Websock() {
|
||||||
this._rQ = new Uint8Array(this._rQbufferSize);
|
this._rQ = new Uint8Array(this._rQbufferSize);
|
||||||
this._rQ.set(new Uint8Array(old_rQbuffer, this._rQi));
|
this._rQ.set(new Uint8Array(old_rQbuffer, this._rQi));
|
||||||
} else {
|
} else {
|
||||||
if (this._rQ.copyWithin) {
|
if (ENABLE_COPYWITHIN) {
|
||||||
// Firefox only, ATM
|
|
||||||
this._rQ.copyWithin(0, this._rQi);
|
this._rQ.copyWithin(0, this._rQi);
|
||||||
} else {
|
} else {
|
||||||
this._rQ.set(new Uint8Array(this._rQ.buffer, this._rQi));
|
this._rQ.set(new Uint8Array(this._rQ.buffer, this._rQi));
|
||||||
|
|
Loading…
Reference in New Issue