You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/09/18 00:53:28 UTC
[incubator-echarts] branch line-optimize updated: perf: optimize
data access in points layout
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch line-optimize
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/line-optimize by this push:
new 170f893 perf: optimize data access in points layout
170f893 is described below
commit 170f893c8889a9a6d18bd751b72caa8b9ed703f3
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Sep 18 08:52:22 2020 +0800
perf: optimize data access in points layout
---
src/layout/points.ts | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/layout/points.ts b/src/layout/points.ts
index e819581..5ee4c75 100644
--- a/src/layout/points.ts
+++ b/src/layout/points.ts
@@ -56,6 +56,11 @@ export default function (seriesType: string, forceStoreInTypedArray?: boolean):
dims[1] = stackResultDim;
}
+ const dimInfo0 = data.getDimensionInfo(0);
+ const dimInfo1 = data.getDimensionInfo(1);
+
+ const dimIdx0 = dimInfo0 && dimInfo0.index;
+ const dimIdx1 = dimInfo1 && dimInfo1.index;
return dimLen && {
progress(params, data) {
@@ -64,16 +69,17 @@ export default function (seriesType: string, forceStoreInTypedArray?: boolean):
const tmpIn: ParsedValueNumeric[] = [];
const tmpOut: number[] = [];
+
for (let i = params.start, offset = 0; i < params.end; i++) {
let point;
if (dimLen === 1) {
- const x = data.get(dims[0], i) as ParsedValueNumeric;
+ const x = data.getByDimIdx(dimIdx0, i) as ParsedValueNumeric;
point = !isNaN(x) && coordSys.dataToPoint(x, null, tmpOut);
}
else {
- const x = tmpIn[0] = data.get(dims[0], i) as ParsedValueNumeric;
- const y = tmpIn[1] = data.get(dims[1], i) as ParsedValueNumeric;
+ const x = tmpIn[0] = data.getByDimIdx(dimIdx0, i) as ParsedValueNumeric;
+ const y = tmpIn[1] = data.getByDimIdx(dimIdx1, i) as ParsedValueNumeric;
// Also {Array.<number>}, not undefined to avoid if...else... statement
point = !isNaN(x) && !isNaN(y) && coordSys.dataToPoint(tmpIn, null, tmpOut);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org