summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolly Ross <sross@redhat.com>2015-12-22 13:51:30 -0500
committerSolly Ross <sross@redhat.com>2015-12-22 13:51:30 -0500
commitc8f14d175bbfe00f69fde268bd10de2b80a089d9 (patch)
treea3767161515e98c07138464b23fed71b21b06db5
parenta0e7ab43dca0ce11a713694ee4cf530bd3b17c5a (diff)
downloadnovnc-c8f14d175bbfe00f69fde268bd10de2b80a089d9.tar.gz
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.
-rw-r--r--include/websock.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/websock.js b/include/websock.js
index 892238b..7c27255 100644
--- a/include/websock.js
+++ b/include/websock.js
@@ -67,6 +67,11 @@ function Websock() {
(function () {
"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 () {
// This is only for PhantomJS, which doesn't like apply-ing
// with Typed Arrays
@@ -364,8 +369,7 @@ function Websock() {
this._rQ = new Uint8Array(this._rQbufferSize);
this._rQ.set(new Uint8Array(old_rQbuffer, this._rQi));
} else {
- if (this._rQ.copyWithin) {
- // Firefox only, ATM
+ if (ENABLE_COPYWITHIN) {
this._rQ.copyWithin(0, this._rQi);
} else {
this._rQ.set(new Uint8Array(this._rQ.buffer, this._rQi));