快速文件的输出编译持续时间 [英] Output compile durations for swift files

查看:95
本文介绍了快速文件的输出编译持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在xcode构建过程中转换输出编译swift文件所花费的时间?

Is there a way to turn output the time taken to compile a swift file during an xcode build?

我想从命令行进行编译以触发相同的构建xcode,但要包括编译每个文件所花费的时间。

I would like to compile from the command line to trigger the same build xcode does but to include the time taken to compile each file.

报告导航器显示每个文件的完整构建报告,但没有与之关联的时间范围。

The Report Navigator show full build reports per file but there is no timeframe associated with them.

目前尚不清楚通过将加载状态和加载状态等作为其更客气的样式。

Its not clear on compile times by looking and the loading state etc. as its more guestimate style.

我想减少Swift的编译时间1.2项目,因为清理后大约需要5-10分钟,而在高度依赖的文件中更改源大约需要3 -5分钟。

I would like to cut down the compile time of a Swift 1.2 project, as it takes around 5 - 10 minutes after a clean or 3 -5 minutes after changing source in a heavily dependent file.

推荐答案

您可以添加…

-Xfrontend -debug-time-function-bodies

…到 Swift编译器中的其他Swift标志-自定义标志部分(构建设置) 。

…to Other Swift Flags in Swift Compiler - Custom Flags section (build settings).

注意:是您必须保持这些标志的顺序相同。 -Xfrontend 表示应将下一个标志传递给前端。

Note: You have to keep same order of these flags. -Xfrontend says that the next flag should be passed to the frontend. It will not work if you reverse the order.

然后您可以在构建日志中获得编译时间:

Then you can get compile times in your build log:

当您这样做时,这很有用要优化编译时间,并且在向 Apple Swift成员报告问题时,最好附上这种构建日志。

Which is useful when you do want to optimize compile time and also it's good to attach this kind of build log when reporting an issue to Apple Swift guys about slow compile time.

信用转到 Joe Pamer 错误的编译器黑客。目前是Apple(Swift,Clang)的工程经理,曾是Microsoft(TypeScript,F#,JavaScript,.NET)的工程师。他在Twitter上发布了此消息,以回应Rob Rix有关对Swift编译进行概要分析的问题。这让我感到好奇,因此,我反汇编了编译器,检查了文本部分以获取更多标志,并发现了其他隐藏选项

Credit goes to Joe Pamer Errant compiler hacker. Currently an engineering manager at Apple (Swift, Clang), formerly at Microsoft (TypeScript, F#, JavaScript, .NET). He tweeted it as a response to Rob Rix question about profiling Swift compilation. It made me curious, so, I disassembled compiler, checked text section for more flags and found other hidden options. Don't use them in production code, just play with them.

整个项目的构建时间。不要在生产代码中使用它们。在终端中运行以下命令…

Build time of the whole project. Run following command in terminal…

defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES

…重新启动Xcode,清理&构建并…

…restart Xcode, clean & build and…

对您的豆荚项目

这篇关于快速文件的输出编译持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆