Tag: 编译器优化

如何禁用V8的优化编译器

我正在写一个常量string比较函数(对于node.js),并希望禁用V8的这个单一函数的优化编译器; 使用命令行标志是不可能的。 我知道使用with{} (或try / catch)块会立即禁用优化编译器,但是恐怕这个“function”(bug)将在未来的版本中得到修复。 有没有一个不可变的(和文件)的方式禁用V8的优化编译器? function示例: function constantTimeStringCompare( a, b ) { // By adding a `with` block here, we disable v8's optimizing compiler. // Using Object.create(null) ensures we don't have any object prototype properties getting in our way.our way. with ( Object.create( null ) ){ var valid = true, length = Math.max( […]