相关疑难解决方法(0)

Bluebird的util.toFastProperties函数如何使对象的属性"快速"?

在Bluebird的util.js文件中,它具有以下功能:

function toFastProperties(obj) {
    /*jshint -W027*/
    function f() {}
    f.prototype = obj;
    ASSERT("%HasFastProperties", true, obj);
    return f;
    eval(obj);
}
Run Code Online (Sandbox Code Playgroud)

出于某种原因,在返回函数之后有一个声明,我不知道它为什么存在.

同样,它似乎是故意的,因为作者已经沉默了JSHint对此的警告:

'return'后无法访问'eval'.(W027)

这个功能到底是做什么的?难道util.toFastProperties真的让一个对象的属性"快"?

我在Bluebird的GitHub存储库中搜索了源代码中的任何注释或者问题列表中的解释,但我找不到任何注释.

javascript performance v8 node.js bluebird

165
推荐指数
1
解决办法
1万
查看次数

标签 统计

bluebird ×1

javascript ×1

node.js ×1

performance ×1

v8 ×1