测试 std/:

    1. cargo test std_tests

    代码检查与格式化

    检查

    1. ./tools/lint.py

    格式化

    1. ./tools/format.py

    V8 将在当前目录写入一个文件,像这样 isolate-0x7fad98242400-v8.log。查看这个文件:

    1. D8_PATH=target/release/ ./third_party/v8/tools/linux-tick-processor
    2. isolate-0x7fad98242400-v8.log > prof.log
    3. # 在 macOS 上, 使用 ./third_party/v8/tools/mac-tick-processor

    用 Web UI 查看这个日志,先生成 JSON 文件:

    1. D8_PATH=target/release/ ./third_party/v8/tools/linux-tick-processor
    2. 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 调试

    1. $ lldb -- target/debug/deno run tests/worker.js
    2. > run
    3. > bt
    4. > up
    5. > l

    V8 选项

    V8 有很多内部的命令行选项。

    1. # 列出可用的 V8 选项
    2. $ deno --v8-flags=--help
    3. # 使用多个选项的示例
    4. $ deno --v8-flags=--expose-gc,--use-strict

    特别有用的:

    1. --async-stack-trace

    参考我们的测试

    测试图表假设 https://github.com/denoland/benchmark_data/blob/gh-pages/data.json 有着 BenchmarkData[] 类型。以下是 BenchmarkData 的定义:

    1. interface ExecTimeData {
    2. mean: number;
    3. stddev: number;
    4. user: number;
    5. min: number;
    6. }
    7. interface BenchmarkData {
    8. created_at: string;
    9. sha1: string;
    10. benchmark: {
    11. [key: string]: ExecTimeData;
    12. };
    13. binarySizeData: {
    14. [key: string]: number;
    15. };
    16. threadCountData: {
    17. [key: string]: number;
    18. };
    19. syscallCountData: {
    20. [key: string]: number;
    21. };