Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e45bff9

Browse filesBrowse files
committed
perf improvements in fx helpers
1 parent 60bd4fc commit e45bff9
Copy full SHA for e45bff9

File tree

1 file changed

+8
-4
lines changed
Filter options

1 file changed

+8
-4
lines changed

‎src/components/fx/helpers.js

Copy file name to clipboardExpand all lines: src/components/fx/helpers.js
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ exports.getSubplot = function getSubplot(trace) {
1717

1818
// convenience functions for mapping all relevant axes
1919
exports.flat = function flat(subplots, v) {
20-
var out = [];
21-
for(var i = subplots.length; i > 0; i--) out.push(v);
20+
var out = new Array(subplots.length);
21+
for(var i = 0; i < subplots.length; i++) {
22+
out[i] = v;
23+
}
2224
return out;
2325
};
2426

2527
exports.p2c = function p2c(axArray, v) {
26-
var out = [];
27-
for(var i = 0; i < axArray.length; i++) out.push(axArray[i].p2c(v));
28+
var out = new Array(axArray.length);
29+
for(var i = 0; i < axArray.length; i++) {
30+
out[i] = axArray[i].p2c(v);
31+
}
2832
return out;
2933
};
3034

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.