gpt4 book ai didi

f# - 如何使 f# 编译器 (fsc) 冗长?

转载 作者:行者123 更新时间:2023-12-05 00:31:11 25 4
gpt4 key购买 nike

我有一个小型或中等规模的 F# 项目,15 个 *.fs 文件,大约 2000 行代码。编译突然有点慢,大约5秒。我想找出导致编译速度变慢的原因,但找不到像“详细”这样的 fsc 开关,导致它显示进度信息。

有人知道如何跟踪 F# 编译器 fsc 以了解在哪里调整编译吗?

最佳答案

--times开关“显示编译的时间信息”。它显示了非常详细的信息,应该可以帮助您弄清楚是什么导致了这么长时间

编译以下程序

open System

[<EntryPoint>]
let main argv =
printfn "Hello World"
Console.ReadLine() |> ignore
0

产生这个输出

Microsoft (R) F# Compiler version 12.0.30110.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

TIME: 0.1 Delta: 0.0 Mem: 34 G0: 0 G1: 0 G2: 0 [Import mscorlib]
TIME: 0.1 Delta: 0.0 Mem: 35 G0: 0 G1: 0 G2: 0 [Import mscorlib and FSharp.Core.dll]
TIME: 0.4 Delta: 0.3 Mem: 60 G0: 5 G1: 3 G2: 1 [Import system references]
TIME: 0.4 Delta: 0.0 Mem: 64 G0: 1 G1: 1 G2: 0 [Parse inputs]
TIME: 0.4 Delta: 0.0 Mem: 64 G0: 0 G1: 0 G2: 0 [Import non-system references]
TIME: 0.5 Delta: 0.1 Mem: 68 G0: 1 G1: 1 G2: 0 [Typecheck]
TIME: 0.5 Delta: 0.0 Mem: 68 G0: 0 G1: 0 G2: 0 [Typechecked]
TIME: 0.5 Delta: 0.0 Mem: 69 G0: 0 G1: 0 G2: 0 [Write Interface File]
TIME: 0.5 Delta: 0.0 Mem: 69 G0: 0 G1: 0 G2: 0 [Write XML document signatures]
TIME: 0.5 Delta: 0.0 Mem: 69 G0: 0 G1: 0 G2: 0 [Write XML docs]
TIME: 0.5 Delta: 0.0 Mem: 69 G0: 0 G1: 0 G2: 0 [Write HTML docs]
TIME: 0.6 Delta: 0.1 Mem: 73 G0: 2 G1: 1 G2: 1 [Encode Interface Data]
TIME: 0.7 Delta: 0.1 Mem: 76 G0: 1 G1: 1 G2: 0 [Optimizations]
TIME: 0.7 Delta: 0.0 Mem: 77 G0: 0 G1: 0 G2: 0 [Ending Optimizations]
TIME: 0.7 Delta: 0.0 Mem: 77 G0: 0 G1: 0 G2: 0 [Encoding OptData]
TIME: 0.7 Delta: 0.0 Mem: 77 G0: 0 G1: 0 G2: 0 [TAST -> ILX]
TIME: 0.7 Delta: 0.0 Mem: 77 G0: 0 G1: 0 G2: 0 [ILX -> IL (Unions)]
TIME: 0.7 Delta: 0.0 Mem: 77 G0: 0 G1: 0 G2: 0 [ILX -> IL (Funcs)]

ilwrite: TIME 0.000 (total) 0.686 (delta) - Write Started
ilwrite: TIME 0.000 (total) 0.000 (delta) - Module Generation Preparation
ilwrite: TIME 0.000 (total) 0.000 (delta) - Module Generation Pass 1
ilwrite: TIME 0.000 (total) 0.000 (delta) - Module Generation Pass 2
ilwrite: TIME 0.016 (total) 0.016 (delta) - Module Generation Pass 3
ilwrite: TIME 0.016 (total) 0.000 (delta) - Module Generation Pass 4
ilwrite: TIME 0.016 (total) 0.000 (delta) - Finalize Module Generation Results
ilwrite: TIME 0.016 (total) 0.000 (delta) - Generated Tables and Code
ilwrite: TIME 0.016 (total) 0.000 (delta) - Layout Header of Tables
ilwrite: TIME 0.016 (total) 0.000 (delta) - Build String/Blob Address Tables
ilwrite: TIME 0.016 (total) 0.000 (delta) - Sort Tables
ilwrite: TIME 0.016 (total) 0.000 (delta) - Write Header of tablebuf
ilwrite: TIME 0.016 (total) 0.000 (delta) - Write Tables to tablebuf
ilwrite: TIME 0.016 (total) 0.000 (delta) - Layout Metadata
ilwrite: TIME 0.016 (total) 0.000 (delta) - Write Metadata Header
ilwrite: TIME 0.016 (total) 0.000 (delta) - Write Metadata Tables
ilwrite: TIME 0.016 (total) 0.000 (delta) - Write Metadata Strings
ilwrite: TIME 0.016 (total) 0.000 (delta) - Write Metadata User Strings
ilwrite: TIME 0.016 (total) 0.000 (delta) - Write Blob Stream
ilwrite: TIME 0.016 (total) 0.000 (delta) - Fixup Metadata
ilwrite: TIME 0.016 (total) 0.000 (delta) - Generated IL and metadata
ilwrite: TIME 0.016 (total) 0.000 (delta) - Layout image
ilwrite: TIME 0.016 (total) 0.000 (delta) - Writing Image
ilwrite: TIME 0.016 (total) 0.000 (delta) - Finalize PDB
ilwrite: TIME 0.016 (total) 0.000 (delta) - Signing Image
TIME: 0.7 Delta: 0.0 Mem: 78 G0: 0 G1: 0 G2: 0 [Write .NET Binary]
TIME: 0.7 Delta: 0.0 Mem: 78 G0: 0 G1: 0 G2: 0 [Write Stats File]

关于f# - 如何使 f# 编译器 (fsc) 冗长?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25453894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com