<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js'></script>
var MyObject = {
"page": {
"report": {
"id": 8605,
"name": 8605,
"components": [
{
"id": "root",
"name": "页面",
"componentName": "Root",
"componentType": "container",
"props": {
"relatedFilterContainerId": "Filter_global",
"common": {},
"format": {
"layout": {
"cols": 24,
"gap": 10
},
"pageConfig": {
"layoutMode": "grid",
"freeGridSticky": true
}
}
}
},
{
"id": "Filter_global",
"name": "全局筛选",
"componentName": "Filter",
"componentType": "container",
"props": {
"format": {
"styleConfig": {
"showQueryButton": true
}
}
}
},
{
"id": "Chart_e5fwOQi4gu",
"name": "明细表格[i4gu]",
"componentName": "ProTable",
"componentType": "chart",
"props": {
"editExt": {},
"format": {
"titleConfig": {
"enable": true,
"size": "medium",
"showTotal": true
},
"toolbarConfig": {
"enable": true
},
"styleConfig": {
"size": "medium",
"ghost": false,
"hasBorder": true,
"isZebra": true
},
"customSettingConfig": {
"enable": true,
"calcByCustomDims": true,
"iconType": "show-text"
},
"paginationConfig": {
"enable": true,
"defaultPageSize": 10,
"type": "normal",
"size": "medium",
"hideOnlyOnePage": false
},
"rowSelectionConfig": {
"width": 50,
"lock": true
}
}
},
"dataSource": {
"label": "测试",
"code": "1341",
"type": "dataset",
"originType": "file",
"originCode": "b20b28ad-9a31-4166-a663-27ffd626fc54",
"isMultiDim": false,
"isSelfAnalytic": true,
"props": {
"permissionType": [
1,
2,
3
],
"applyPermissionItem": [],
"allowApply": 1,
"secretLevel": 2,
"dataMaxZoneConfig": {
"ptKey": "ds",
"ptRange": 30
},
"dataDownloadByDataShare": {
"switch": [
"true"
]
},
"driverType": "hologresDriver",
"originDatabaseName": "",
"originTableName": "-"
}
},
"fields": [
{
"id": "field_QejV1RmLUb",
"fieldType": "dimension",
"processType": "",
"dataType": "date",
"originCode": "日期",
"code": "日期-5d4c1f",
"originLabel": "日期",
"label": "日期",
"formula": {
"timeType": "YYYY-MM-DD"
},
"ext": {},
"props": {
"sortable": true,
"textFormatConfig": {
"formatType": "date"
},
"align": "left",
"width": 100
}
},
{
"id": "field_M7yVYyeOec",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "仓名称",
"code": "仓名称",
"originLabel": "仓名称",
"label": "仓名称",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_HS3tIrUU3D",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "仓code",
"code": "仓code",
"originLabel": "仓code",
"label": "仓code",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_CsNnoSYt5m",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "区域名称",
"code": "区域名称",
"originLabel": "区域名称",
"label": "区域名称",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_TfgKWSMh7E",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "商品状态",
"code": "商品状态",
"originLabel": "商品状态",
"label": "商品状态",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_EjWJBgVed6",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "商品id",
"code": "商品id",
"originLabel": "商品id",
"label": "商品id",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_rA3PPjx7QM",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付件数",
"code": "支付件数-3dhxpxrvhppp",
"originLabel": "支付件数",
"label": "支付件数",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
},
{
"id": "field_eTO1eWBFBf",
"fieldType": "indicator",
"processType": "",
"dataType": "decimal",
"originCode": "支付金额",
"code": "支付金额-stdmdchy4q28",
"originLabel": "支付金额",
"label": "支付金额",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 2
},
"align": "right",
"width": 100
}
},
{
"id": "field_R34LBUT6dh",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付用户数",
"code": "支付用户数-zpnrb52liasj",
"originLabel": "支付用户数",
"label": "支付用户数",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
},
{
"id": "field_wp3lUegaq7",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付子订单数",
"code": "支付子订单数-v0shth97lsmw",
"originLabel": "支付子订单数",
"label": "支付子订单数",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
}
]
},
{
"id": "Chart_YJCg8RRRZ5",
"name": "明细表格[i4gu]",
"componentName": "DeliciousChart_line",
"componentType": "chart",
"props": {
"editExt": {},
"format": {
"titleConfig": {
"enable": true,
"size": "medium",
"showTotal": true
},
"toolbarConfig": {
"enable": true
},
"globalConfig": {
"forceFit": true,
"fitHeight": true,
"padding": [
12,
12,
12,
12
],
"fitMode": "totalFit"
},
"legendConfig": {
"enable": true,
"position": "top-left",
"align": "center",
"verticalAlign": "center"
},
"tooltipConfig": {
"enable": true,
"showTitle": true,
"width": 160
},
"annotation": {}
}
},
"dataSource": {
"label": "测试",
"code": "1341",
"type": "dataset",
"originType": "file",
"originCode": "b20b28ad-9a31-4166-a663-27ffd626fc54",
"isMultiDim": false,
"isSelfAnalytic": true,
"props": {
"permissionType": [
1,
2,
3
],
"applyPermissionItem": [],
"allowApply": 1,
"secretLevel": 2,
"dataMaxZoneConfig": {
"ptKey": "ds",
"ptRange": 30
},
"dataDownloadByDataShare": {
"switch": [
"true"
]
},
"driverType": "hologresDriver",
"originDatabaseName": "",
"originTableName": "-"
}
},
"fields": [
{
"id": "field_QejV1RmLUb",
"fieldType": "dimension",
"processType": "",
"dataType": "date",
"originCode": "日期",
"code": "日期-5d4c1f",
"originLabel": "日期",
"label": "日期",
"formula": {
"timeType": "YYYY-MM-DD"
},
"groupName": "row",
"ext": {},
"props": {
"sortable": true,
"textFormatConfig": {
"formatType": "date"
},
"align": "left",
"width": 100
}
},
{
"id": "field_rA3PPjx7QM",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付件数",
"code": "支付件数-3dhxpxrvhppp",
"originLabel": "支付件数",
"label": "支付件数",
"formula": {
"aggregationType": "SUM"
},
"groupName": "y1",
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
},
{
"id": "field_eTO1eWBFBf",
"fieldType": "indicator",
"processType": "",
"dataType": "decimal",
"originCode": "支付金额",
"code": "支付金额-stdmdchy4q28",
"originLabel": "支付金额",
"label": "支付金额",
"formula": {
"aggregationType": "SUM"
},
"groupName": "y1",
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 2
},
"align": "right",
"width": 100
}
},
{
"id": "field_R34LBUT6dh",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付用户数",
"code": "支付用户数-zpnrb52liasj",
"originLabel": "支付用户数",
"label": "支付用户数",
"formula": {
"aggregationType": "SUM"
},
"groupName": "y1",
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
},
{
"id": "field_QejV1RmLUb",
"fieldType": "dimension",
"processType": "",
"dataType": "date",
"originCode": "日期",
"code": "日期-5d4c1f",
"originLabel": "日期",
"label": "日期",
"formula": {
"timeType": "YYYY-MM-DD"
},
"groupName": "subdivision",
"ext": {},
"props": {
"sortable": true,
"textFormatConfig": {
"formatType": "date"
},
"align": "left",
"width": 100
}
}
]
},
{
"id": "Chart_uxl22BaV39",
"name": "明细表格[i4gu]",
"componentName": "ProTable",
"componentType": "chart",
"props": {
"editExt": {},
"format": {
"titleConfig": {
"enable": true,
"size": "medium",
"showTotal": true
},
"toolbarConfig": {
"enable": true
},
"styleConfig": {
"size": "medium",
"ghost": false,
"hasBorder": true,
"isZebra": true
},
"customSettingConfig": {
"enable": true,
"calcByCustomDims": true,
"iconType": "show-text"
},
"paginationConfig": {
"enable": true,
"defaultPageSize": 10,
"type": "normal",
"size": "medium",
"hideOnlyOnePage": false
},
"rowSelectionConfig": {
"width": 50,
"lock": true
}
}
},
"dataSource": {
"label": "测试",
"code": "1341",
"type": "dataset",
"originType": "file",
"originCode": "b20b28ad-9a31-4166-a663-27ffd626fc54",
"isMultiDim": false,
"isSelfAnalytic": true,
"props": {
"permissionType": [
1,
2,
3
],
"applyPermissionItem": [],
"allowApply": 1,
"secretLevel": 2,
"dataMaxZoneConfig": {
"ptKey": "ds",
"ptRange": 30
},
"dataDownloadByDataShare": {
"switch": [
"true"
]
},
"driverType": "hologresDriver",
"originDatabaseName": "",
"originTableName": "-"
}
},
"fields": [
{
"id": "field_QejV1RmLUb",
"fieldType": "dimension",
"processType": "",
"dataType": "date",
"originCode": "日期",
"code": "日期-5d4c1f",
"originLabel": "日期",
"label": "日期",
"formula": {
"timeType": "YYYY-MM-DD"
},
"ext": {},
"props": {
"sortable": true,
"textFormatConfig": {
"formatType": "date"
},
"align": "left",
"width": 100
}
},
{
"id": "field_M7yVYyeOec",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "仓名称",
"code": "仓名称",
"originLabel": "仓名称",
"label": "仓名称",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_HS3tIrUU3D",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "仓code",
"code": "仓code",
"originLabel": "仓code",
"label": "仓code",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_CsNnoSYt5m",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "区域名称",
"code": "区域名称",
"originLabel": "区域名称",
"label": "区域名称",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_TfgKWSMh7E",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "商品状态",
"code": "商品状态",
"originLabel": "商品状态",
"label": "商品状态",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_EjWJBgVed6",
"fieldType": "dimension",
"processType": "",
"dataType": "string",
"originCode": "商品id",
"code": "商品id",
"originLabel": "商品id",
"label": "商品id",
"formula": null,
"ext": {},
"props": {
"sortable": true,
"align": "left",
"width": 100
}
},
{
"id": "field_rA3PPjx7QM",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付件数",
"code": "支付件数-3dhxpxrvhppp",
"originLabel": "支付件数",
"label": "支付件数",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
},
{
"id": "field_eTO1eWBFBf",
"fieldType": "indicator",
"processType": "",
"dataType": "decimal",
"originCode": "支付金额",
"code": "支付金额-stdmdchy4q28",
"originLabel": "支付金额",
"label": "支付金额",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 2
},
"align": "right",
"width": 100
}
},
{
"id": "field_R34LBUT6dh",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付用户数",
"code": "支付用户数-zpnrb52liasj",
"originLabel": "支付用户数",
"label": "支付用户数",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
},
{
"id": "field_wp3lUegaq7",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付子订单数",
"code": "支付子订单数-v0shth97lsmw",
"originLabel": "支付子订单数",
"label": "支付子订单数",
"formula": {
"aggregationType": "SUM"
},
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
}
}
]
},
{
"id": "Row_hwjmraFGTK",
"name": "行布局",
"componentName": "Row",
"componentType": "container",
"props": {
"format": {}
}
},
{
"id": "Chart_1kgue2Tk4j",
"name": "明细表格[i4gu]",
"componentName": "Card_common_indicator",
"componentType": "chart",
"props": {
"editExt": {},
"format": {
"titleConfig": {
"enable": true,
"size": "medium",
"showTotal": true
},
"styleConfig": {
"cardStyleType": "radiusBorder",
"showSlider": false,
"widthType": ""
},
"toolbarConfig": {
"enable": true
}
}
},
"dataSource": {
"label": "测试",
"code": "1341",
"type": "dataset",
"originType": "file",
"originCode": "b20b28ad-9a31-4166-a663-27ffd626fc54",
"isMultiDim": false,
"isSelfAnalytic": true,
"props": {
"permissionType": [
1,
2,
3
],
"applyPermissionItem": [],
"allowApply": 1,
"secretLevel": 2,
"dataMaxZoneConfig": {
"ptKey": "ds",
"ptRange": 30
},
"dataDownloadByDataShare": {
"switch": [
"true"
]
},
"driverType": "hologresDriver",
"originDatabaseName": "",
"originTableName": "-"
}
},
"fields": [
{
"id": "field_rA3PPjx7QM",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付件数",
"code": "支付件数-3dhxpxrvhppp",
"originLabel": "支付件数",
"label": "支付件数",
"formula": {
"aggregationType": "SUM"
},
"groupName": "Main",
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
},
"groupIndex": 0
},
{
"id": "field_eTO1eWBFBf",
"fieldType": "indicator",
"processType": "",
"dataType": "decimal",
"originCode": "支付金额",
"code": "支付金额-stdmdchy4q28",
"originLabel": "支付金额",
"label": "支付金额",
"formula": {
"aggregationType": "SUM"
},
"groupName": "Main",
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 2
},
"align": "right",
"width": 100
},
"groupIndex": 1
},
{
"id": "field_R34LBUT6dh",
"fieldType": "indicator",
"processType": "",
"dataType": "bigint",
"originCode": "支付用户数",
"code": "支付用户数-zpnrb52liasj",
"originLabel": "支付用户数",
"label": "支付用户数",
"formula": {
"aggregationType": "SUM"
},
"groupName": "Main",
"ext": {},
"props": {
"sortable": true,
"valueFormatConfig": {
"formatType": "number",
"hasThousandths": true,
"decimalDigits": 0
},
"align": "right",
"width": 100
},
"groupIndex": 2
}
]
}
],
"layout": {
"_root": [
{
"id": "root",
"height": 0,
"width": 24
}
],
"root": [
{
"id": "Chart_1kgue2Tk4j",
"height": 172,
"width": 24
},
{
"id": "Row_hwjmraFGTK",
"width": 24,
"height": 511,
"container": "Row"
},
{
"id": "Chart_YJCg8RRRZ5",
"height": 352,
"width": 24
}
],
"Row_hwjmraFGTK": [
{
"id": "Chart_e5fwOQi4gu",
"height": 511,
"width": 12
},
{
"id": "Chart_uxl22BaV39",
"height": 511,
"width": 12
}
]
},
"linkages": [],
"filters": [],
"options": {},
"setting": {},
"datasetDict": {}
},
"setting": {}
},
"loadModule": {
"engines": {
"ascp-visual/sailing": [
"1.0.3",
"1.0.4"
]
},
"bundles": {},
"theme": {
"ascp-design/ascp-design": [
"7.0.3",
"7.0.3"
]
},
"customBundles": {}
}
}
var myCopy = null;
myCopy = _.cloneDeep(MyObject);
myCopy = structuredClone(MyObject);
myCopy = JSON.parse(JSON.stringify(MyObject));
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Lodash cloneDeep | |
Native structuredClone | |
JSON Parse |
Test name | Executions per second |
---|---|
Lodash cloneDeep | 6936.7 Ops/sec |
Native structuredClone | 14668.1 Ops/sec |
JSON Parse | 19941.2 Ops/sec |
A complex benchmarking scenario!
After analyzing the data, I'll attempt to provide an answer.
Individual test cases:
Latest benchmark result:
Observations:
cloneDeep
is the fastest, with an execution rate of approximately 20 executions per second.structuredClone
is slower than expected, but still faster than JSON Parse.Conclusion:
Lodash's cloneDeep
is currently the fastest method for cloning a complex object like MyObject
. However, it's worth noting that the results may vary depending on the specific use case and environment.