提交 918fac39 编写于 作者: Y y00314596

add by yangqing3@huawei.com

Signed-off-by: Ny00314596 <yangqing3@huawei.com>
上级 df247916
......@@ -40,8 +40,8 @@ static napi_value GetFileList(napi_env env, napi_callback_info info)
int count = OH_ResourceManager_GetRawFileCount(rawDir);
std::vector<std::string> tempArray;
for(int i = 0; i < count; i++) {
std::string filename = OH_ResourceManager_GetRawFileName(rawDir, i);
tempArray.emplace_back(filename);
std::string rawfilename = OH_ResourceManager_GetRawFileName(rawDir, i);
tempArray.emplace_back(rawfilename);
}
napi_value fileList;
......
......@@ -1762,6 +1762,31 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5920
* @tc.name test the performance of Locale
* @tc.desc check the performance of Locale
*/
it('perf_test_5920', 0, function () {
console.log('perf_test_5920 ' + 'start');
let locale = null;
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
locale = new Intl.Locale();
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_5920--'
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6000
* @tc.name test the performance of toString
......@@ -1870,6 +1895,31 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6320
* @tc.name test the performance of DateTimeFormat
* @tc.desc check the performance of DateTimeFormat
*/
it('perf_test_6320', 0, function () {
console.log('perf_test_6320 ' + 'start');
let datefmt = null;
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
datefmt = new Intl.DateTimeFormat();
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_6320--'
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6400
* @tc.name test the performance of DateTimeFormat.format
......@@ -1979,6 +2029,31 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6720
* @tc.name test the performance of NumberFormat
* @tc.desc check the performance of NumberFormat
*/
it('perf_test_6720', 0, function () {
console.log('perf_test_6720 ' + 'start');
let numfmt = null;
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
numfmt = new Intl.NumberFormat();
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_6720--'
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6800
* @tc.name test the performance of NumberFormat.format
......@@ -2062,6 +2137,31 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7020
* @tc.name test the performance of PluralRules
* @tc.desc check the performance of PluralRules
*/
it('perf_test_7020', 0, function () {
console.log('perf_test_7020 ' + 'start');
let pl = null;
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
pl = new Intl.PluralRules();
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_7020--'
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7100
* @tc.name test the performance of PluralRules.select
......@@ -2114,6 +2214,31 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7220
* @tc.name test the performance of Collator
* @tc.desc check the performance of Collator
*/
it('perf_test_7220', 0, function () {
console.log('perf_test_7220 ' + 'start');
let coll = null;
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
coll = new Intl.Collator();
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_7220--'
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7300
* @tc.name test the performance of Collator.compare with same param
......@@ -2218,6 +2343,31 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7620
* @tc.name test the performance of RelativeTimeFormat
* @tc.desc check the performance of RelativeTimeFormat
*/
it('perf_test_7620', 0, function () {
console.log('perf_test_7620 ' + 'start');
let relativetimefmt = null;
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
relativetimefmt = new Intl.RelativeTimeFormat();
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_7620--'
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7700
* @tc.name test the performance of RelativeTimeFormat.format
......@@ -2666,5 +2816,57 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_9600
* @tc.name test the performance of Normalizer.getInstance
* @tc.desc check the performance of Normalizer.getInstance
*/
it('perf_test_9600', 0, function () {
console.log('perf_test_9600 ' + 'start');
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC);
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_9600--'
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_9700
* @tc.name test the performance of Normalizer.normalize
* @tc.desc check the performance of Normalizer.normalize
*/
it('perf_test_9700', 0, function () {
console.log('perf_test_9700 ' + 'start');
let str = '\u1e9b\u0323';
let value = 'test';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC);
let startTime = new Date().getTime();
for(let i = 0; i < EXETIME; i++){
value = normal.normalize(str);
}
let exeTime = new Date().getTime() - startTime;
let avgTime = exeTime/EXETIME;
console.log('perf_test_9700--'
+ ' value: ' + value
+ ' exeTime: ' + exeTime
+ ' avgTime: ' + avgTime);
if(avgTime < 10){
expect(true).assertTrue();
}
else{
expect(false).assertTrue();
}
})
console.log('*************end PerfTest*************');
})}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册