From bb2a1d6f03da24b8b1bfb06f13a00065b2855a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Thu, 4 Aug 2016 11:48:55 -0400 Subject: [PATCH] plots: don't dive into non-container arrays - as before 37e291b0439f5c5baa7df52895bdc22aa2c255d5 - this can lead to significant speed up when large data arrays are present --- src/plots/plots.js | 4 ++-- test/jasmine/tests/plots_test.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plots/plots.js b/src/plots/plots.js index d7a45a44a21..4089d451816 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -610,9 +610,9 @@ function relinkPrivateKeys(toContainer, fromContainer) { toContainer[k] = fromVal; } - else if(isArray(fromVal) && isArray(toVal)) { + else if(isArray(fromVal) && isArray(toVal) && isPlainObject(fromVal[0])) { - // recurse into arrays + // recurse into arrays containers for(var j = 0; j < fromVal.length; j++) { if(isPlainObject(fromVal[j]) && isPlainObject(toVal[j])) { relinkPrivateKeys(toVal[j], fromVal[j]); diff --git a/test/jasmine/tests/plots_test.js b/test/jasmine/tests/plots_test.js index aa9f52d228f..abc63b05fe0 100644 --- a/test/jasmine/tests/plots_test.js +++ b/test/jasmine/tests/plots_test.js @@ -50,6 +50,8 @@ describe('Test Plots', function() { Plots.supplyDefaults(gd); + expect(gd._fullData[0].z).toBe(newData[0].z); + expect(gd._fullData[1].z).toBe(newData[1].z); expect(gd._fullData[1]._empties).toBe(oldFullData[1]._empties); expect(gd._fullLayout.scene._scene).toBe(oldFullLayout.scene._scene); expect(gd._fullLayout._plots).toBe(oldFullLayout._plots);