- data/efficiency-samples/ 23 个多语言样例 + data/manual-review-tool.html 人工审核工具 - tests/measure/measure-plugin-samples.mjs 四语言插件侧测量脚本 - tests/measure/compare-a3.mjs 聚合对比 + results(插件实测/人工基线/comparison) - performance-comparison.md 填实基线对比与结论;README 效果总结由占位改为真实数据
40 lines
742 B
JavaScript
40 lines
742 B
JavaScript
// sample-3: billing service module
|
|
var config = { retries: 3 };
|
|
|
|
function billingProcess(items) {
|
|
var total = 0;
|
|
for (var i = 0; i < items.length; i++) {
|
|
total += items[i].amount;
|
|
}
|
|
if (total == 0) {
|
|
return null;
|
|
}
|
|
return total;
|
|
}
|
|
|
|
function billingValidate(record) {
|
|
var shadowed = record.id;
|
|
function inner() {
|
|
var shadowed = record.alt;
|
|
return shadowed;
|
|
}
|
|
if (record.value === record.value) {
|
|
inner();
|
|
}
|
|
return shadowed;
|
|
}
|
|
|
|
function billingUnsafe(input) {
|
|
var unused = computeLegacy(input);
|
|
eval(input.expression);
|
|
debugger;
|
|
}
|
|
|
|
function computeLegacy(x) {
|
|
if (x.pending) {}
|
|
x.count = x.count;
|
|
return x;
|
|
}
|
|
|
|
module.exports = { billingProcess, billingValidate, billingUnsafe, config };
|