Skip to content

Instantly share code, notes, and snippets.

@modocache
Last active April 12, 2022 22:34
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modocache/3fb21f5dc7fec6f300cacbe6c74c59d2 to your computer and use it in GitHub Desktop.
Save modocache/3fb21f5dc7fec6f300cacbe6c74c59d2 to your computer and use it in GitHub Desktop.
Swift compilation time debugging options and their outputs
Queuing (initial): {compile: foo.o <= foo.swift}
Queuing (initial): {merge-module: Foo.swiftmodule <= foo.o}
Queuing (initial): {link: libFoo.dylib <= foo.o}
===-------------------------------------------------------------------------===
Driver Compilation Time
===-------------------------------------------------------------------------===
Total Execution Time: 0.0009 seconds (0.3250 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0001 ( 39.7%) 0.0001 ( 7.1%) 0.0001 ( 12.5%) 0.2403 ( 73.9%) {compile: foo.o <= foo.swift}
0.0001 ( 55.1%) 0.0007 ( 90.1%) 0.0008 ( 84.3%) 0.0613 ( 18.9%) {compile: bar.o <= bar.swift}
0.0000 ( 5.1%) 0.0000 ( 2.8%) 0.0000 ( 3.2%) 0.0234 ( 7.2%) {merge-module: Main.swiftmodule <= bar.o foo.o}
0.0002 (100.0%) 0.0008 (100.0%) 0.0009 (100.0%) 0.3250 (100.0%) Total
===-------------------------------------------------------------------------===
Swift compilation
===-------------------------------------------------------------------------===
Total Execution Time: 0.0307 seconds (0.1196 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.0043 ( 39.3%) 0.0091 ( 45.6%) 0.0133 ( 43.4%) 0.0547 ( 45.7%) performSema
0.0030 ( 27.5%) 0.0070 ( 35.2%) 0.0100 ( 32.5%) 0.0437 ( 36.5%) performSema-loadStdlib
0.0011 ( 10.0%) 0.0011 ( 5.4%) 0.0022 ( 7.0%) 0.0081 ( 6.7%) performSema-parseAndCheckTypes
0.0008 ( 7.0%) 0.0009 ( 4.4%) 0.0016 ( 5.3%) 0.0067 ( 5.6%) Type checking / Semantic analysis
0.0002 ( 1.7%) 0.0010 ( 4.9%) 0.0012 ( 3.8%) 0.0029 ( 2.4%) performSema-getImplicitlyImportedModules
0.0006 ( 5.3%) 0.0002 ( 1.2%) 0.0008 ( 2.7%) 0.0012 ( 1.0%) SILGen
0.0002 ( 1.4%) 0.0001 ( 0.5%) 0.0003 ( 0.8%) 0.0011 ( 0.9%) AST verification
0.0002 ( 2.1%) 0.0001 ( 0.7%) 0.0004 ( 1.2%) 0.0004 ( 0.3%) IRGen
0.0002 ( 2.0%) 0.0001 ( 0.6%) 0.0003 ( 1.1%) 0.0003 ( 0.3%) Serialization, swiftmodule
0.0001 ( 1.0%) 0.0001 ( 0.5%) 0.0002 ( 0.7%) 0.0002 ( 0.2%) Parsing
0.0001 ( 0.7%) 0.0001 ( 0.4%) 0.0001 ( 0.5%) 0.0001 ( 0.1%) performSema-parsePartialModulesAndLibraryFiles
0.0001 ( 0.7%) 0.0001 ( 0.4%) 0.0001 ( 0.5%) 0.0001 ( 0.1%) performSema-parseLibraryFile
0.0000 ( 0.4%) 0.0000 ( 0.2%) 0.0001 ( 0.2%) 0.0001 ( 0.1%) performSema-checkTypesWhileParsingMain-parseAndTypeCheckMainFile
0.0000 ( 0.3%) 0.0000 ( 0.0%) 0.0000 ( 0.1%) 0.0000 ( 0.0%) SIL verification, pre-optimization
0.0000 ( 0.2%) 0.0000 ( 0.1%) 0.0000 ( 0.1%) 0.0000 ( 0.0%) Serialization, swiftdoc
0.0000 ( 0.2%) 0.0000 ( 0.0%) 0.0000 ( 0.1%) 0.0000 ( 0.0%) SIL optimization
0.0000 ( 0.2%) 0.0000 ( 0.0%) 0.0000 ( 0.1%) 0.0000 ( 0.0%) SIL verification, post-optimization
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) Name binding
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) performSema-importBridgingHeader
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) verifyAllLoadedModules
0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) performWholeModuleTypeChecking
0.0109 (100.0%) 0.0199 (100.0%) 0.0307 (100.0%) 0.1196 (100.0%) Total
48.44ms /Users/bgesiak/Source/modocache/swift-incremental-builder/fixtures/library/foo.swift:12:23 get {}
0.89ms /Users/bgesiak/Source/modocache/swift-incremental-builder/fixtures/library/foo.swift:3:13 public func z() -> Int
43.42ms /Users/bgesiak/Source/modocache/swift-incremental-builder/fixtures/library/foo.swift:7:13 public func a<T, U, V, W, X>(b: T, c: U, d: V, e: W, f: X)
0.01ms /Users/bgesiak/Source/modocache/swift-incremental-builder/fixtures/library/foo.swift:11:15 init()
/Users/bgesiak/Source/modocache/swift-incremental-builder/fixtures/library/foo.swift:4:28: warning: expression took 37ms to type-check (limit: 1ms)
return x + 1 + 2 + 3 + x + Int(0.1)
~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/Users/bgesiak/Source/modocache/swift-incremental-builder/fixtures/library/foo.swift:12:23: warning: getter 'bar' took 47ms to type-check (limit: 1ms)
public var bar: Int {
^
/Users/bgesiak/Source/modocache/swift-incremental-builder/fixtures/library/foo.swift:7:13: warning: global function 'a(b:c:d:e:f:)' took 47ms to type-check (limit: 1ms)
public func a<T, U, V, W, X>(b: T, c: U, d: V, e: W, f: X) {
^
@mlvea
Copy link

mlvea commented Jan 7, 2019

@modocache. Thanks for adding the feature (apple/swift#4367).
I'm using -driver-time-compilation to understand how the driver spends its time on building each module in a project with multiple modules. However, according to the logs, a module in the project shows total wall time greater than the time it takes for the whole project to build. Does the wall time represent the sum of per CPU wall time here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment