测试 std/
:
cargo test std_tests
代码检查与格式化
检查
./tools/lint.py
格式化
./tools/format.py
V8 将在当前目录写入一个文件,像这样 isolate-0x7fad98242400-v8.log
。查看这个文件:
D8_PATH=target/release/ ./third_party/v8/tools/linux-tick-processor
isolate-0x7fad98242400-v8.log > prof.log
# 在 macOS 上, 使用 ./third_party/v8/tools/mac-tick-processor
用 Web UI 查看这个日志,先生成 JSON 文件:
D8_PATH=target/release/ ./third_party/v8/tools/linux-tick-processor
isolate-0x7fad98242400-v8.log --preprocess > prof.json
在您的浏览器中打开 third_party/v8/tools/profview/index.html
,选择 prof.json
以查看分布图。
在性能分析时有用的 V8 选项:
- --prof
- --log-internal-timer-events
- --log-timer-events
- --track-gc
- --track-gc-object-stats
有关 d8
和性能分析的更多信息,请查阅以下链接:
使用 LLDB 调试
$ lldb -- target/debug/deno run tests/worker.js
> run
> bt
> up
> l
V8 选项
V8 有很多内部的命令行选项。
# 列出可用的 V8 选项
$ deno --v8-flags=--help
# 使用多个选项的示例
$ deno --v8-flags=--expose-gc,--use-strict
特别有用的:
--async-stack-trace
参考我们的测试
测试图表假设 https://github.com/denoland/benchmark_data/blob/gh-pages/data.json 有着 BenchmarkData[]
类型。以下是 BenchmarkData
的定义:
interface ExecTimeData {
mean: number;
stddev: number;
user: number;
min: number;
}
interface BenchmarkData {
created_at: string;
sha1: string;
benchmark: {
[key: string]: ExecTimeData;
};
binarySizeData: {
[key: string]: number;
};
threadCountData: {
[key: string]: number;
};
syscallCountData: {
[key: string]: number;
};