提交 0c433417 编写于 作者: 杜庆泉's avatar 杜庆泉

增加UTSJSONObject get 速度测试

上级 27c60e10
......@@ -22522,6 +22522,7 @@ export function testJSONLarge() : Result {
return describe("JSON_large", () => {
test('parse', () => {
// #ifdef APP-ANDROID
UTSAndroid.getDispatcher("io").async(function(_){
let startTime = System.currentTimeMillis()
let listdata = JSON.parseArray<PICKER_ITEM_INFO>(allStr)
let spendTime = System.currentTimeMillis() - startTime
......@@ -22538,6 +22539,8 @@ export function testJSONLarge() : Result {
expect(parseArray.length).toEqual(33);
expect(spendTime < 300).toEqual(true);
console.log('不指定类型转换耗时',spendTime,listdata2)
},null)
// #endif
......
......@@ -62,6 +62,24 @@ export function testUTSJSONObject() : Result {
// #endif
})
test('get-speed', () => {
// #ifdef APP-ANDROID
const utsObj: UTSJSONObject = {} as any as UTSJSONObject
for (let i = 0; i < 100; i++) {
utsObj.set('' + i, '' + i)
}
console.log('--start--')
let startTime = Date.now()
for (let i = 0; i < 10000; i++) {
utsObj.getString('0')
}
let spendTime = Date.now() - startTime
expect(spendTime < 300).toEqual(true);
// #endif
})
test('assign-withtype', () => {
// #ifdef APP-ANDROID
type User = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册