-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * 更新至 G 最新版本 (#2629) * chore: update to latest g deps * chore: update to latest g deps * chore: update to latest g deps * chore: update to latest g deps * chore: update to latest g deps * fix: 修复序号列 clipPath * fix: 处理 bbox 惰性计算的问题 * test: 单测修复 * test: 单测修复 * test: 更新 react snapshot * test: 增加 benchmark * chore: 升级 @antv/g2 * test: 单测修复 * chore: 更新 s2-site g 相关依赖 --------- Co-authored-by: xiaoiver <[email protected]>
- Loading branch information
Showing
30 changed files
with
4,578 additions
and
4,754 deletions.
There are no files selected for viewing
196 changes: 196 additions & 0 deletions
196
packages/s2-core/__tests__/benchmark/pivot-sheet-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
/* eslint-disable no-console */ | ||
import { PivotSheet, S2DataConfig } from '../../src'; | ||
import { generateRawData, getContainer } from '../util/helpers'; | ||
|
||
async function measurePivotSheetRender(s2DataCfg: S2DataConfig, title) { | ||
performance.mark('startTask'); | ||
const s2 = new PivotSheet(getContainer(), s2DataCfg, null); | ||
|
||
await s2.render(); | ||
performance.mark('endTask'); | ||
|
||
const measure = performance.measure('render', 'startTask', 'endTask'); | ||
|
||
console.log(title, measure.duration); | ||
} | ||
|
||
describe('pivot sheet benchmark', () => { | ||
describe('single values', () => { | ||
const baseDataCfg = { | ||
fields: { | ||
rows: ['province', 'city'], | ||
columns: ['type', 'subType'], | ||
values: ['number'], | ||
}, | ||
data: [], | ||
}; | ||
|
||
test('should render 10 * 100', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 10], | ||
['city', 1], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender( | ||
s2DataCfg, | ||
'🚀 10 * 100 for single measure', | ||
); | ||
}); | ||
|
||
test('should render 100 * 100', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 10], | ||
['city', 10], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender( | ||
s2DataCfg, | ||
'🚀 100 * 100 for single measure', | ||
); | ||
}); | ||
|
||
test('should render 1000 * 100', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 100], | ||
['city', 10], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender( | ||
s2DataCfg, | ||
'🚀 1000 * 100 for single measure', | ||
); | ||
}); | ||
|
||
test('should render 1000 * 1000', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 100], | ||
['city', 10], | ||
['type', 100], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender( | ||
s2DataCfg, | ||
'🚀 1000 * 1000 for single measure', | ||
); | ||
}); | ||
}); | ||
|
||
describe('multi values', () => { | ||
const baseDataCfg = { | ||
fields: { | ||
rows: ['province', 'city'], | ||
columns: ['type', 'subType'], | ||
values: ['number'], | ||
}, | ||
data: [], | ||
}; | ||
|
||
test('should render 10 * 100', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 10], | ||
['city', 1], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number1', 'number2', 'number3', 'number4', 'number5'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender(s2DataCfg, '🚀 10 * 100 for multi measure'); | ||
}); | ||
|
||
test('should render 100 * 100', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 10], | ||
['city', 10], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number1', 'number2', 'number3', 'number4', 'number5'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender( | ||
s2DataCfg, | ||
'🚀 100 * 100 for multi measure', | ||
); | ||
}); | ||
|
||
test('should render 1000 * 100', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 100], | ||
['city', 10], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number1', 'number2', 'number3', 'number4', 'number5'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender( | ||
s2DataCfg, | ||
'🚀 1000 * 100 for multi measure', | ||
); | ||
}); | ||
|
||
test('should render 1000 * 1000', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 100], | ||
['city', 10], | ||
['type', 100], | ||
['subType', 10], | ||
], | ||
['number1', 'number2', 'number3', 'number4', 'number5'], | ||
), | ||
}; | ||
|
||
await measurePivotSheetRender( | ||
s2DataCfg, | ||
'🚀 1000 * 1000 for multi measure', | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* eslint-disable no-console */ | ||
import { S2DataConfig, TableSheet } from '../../src'; | ||
import { generateRawData, getContainer } from '../util/helpers'; | ||
|
||
async function measureTableSheetRender(s2DataCfg: S2DataConfig, title) { | ||
performance.mark('startTask'); | ||
const s2 = new TableSheet(getContainer(), s2DataCfg, null); | ||
|
||
await s2.render(); | ||
performance.mark('endTask'); | ||
|
||
const measure = performance.measure('render', 'startTask', 'endTask'); | ||
|
||
console.log(title, measure.duration); | ||
} | ||
|
||
describe('table sheet benchmark', () => { | ||
const baseDataCfg = { | ||
fields: { | ||
columns: ['province', 'city', 'type', 'subType', 'number'], | ||
}, | ||
data: [], | ||
}; | ||
|
||
test('should render 1000 items', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 10], | ||
['city', 1], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measureTableSheetRender(s2DataCfg, '🚀 1000 items'); | ||
}); | ||
|
||
test('should render 10000 items', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 10], | ||
['city', 10], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measureTableSheetRender(s2DataCfg, '🚀 10000 items'); | ||
}); | ||
|
||
test('should render 10_0000 items', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 100], | ||
['city', 10], | ||
['type', 10], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measureTableSheetRender(s2DataCfg, '🚀 10_0000 items'); | ||
}); | ||
|
||
test('should render 100_0000 items', async () => { | ||
const s2DataCfg: S2DataConfig = { | ||
...baseDataCfg, | ||
data: generateRawData( | ||
[ | ||
['province', 100], | ||
['city', 10], | ||
['type', 100], | ||
['subType', 10], | ||
], | ||
['number'], | ||
), | ||
}; | ||
|
||
await measureTableSheetRender(s2DataCfg, '🚀 100_0000 items'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.