3 ms·
It's probably time spent in the linker. The advice of using WPO without opt is verrry circumstantial.
by flamedoge 9y ago
It's probably time spent in the linker. The advice of using WPO without opt is verrry circumstantial.
- slavapestov 9y agoNo, it's valid advice. Non-WMO starts a frontend job for each file, WMO runs one job. The frontend jobs do not share state, so each one parses all the files in the module. In general the parser is very fast, and the type checker tries to only type check declarations in files other than the primary file when absolutely necessary, so it's not always O(n^2). But there are pathological cases you can construct today where the type checker ends up doing too much work.
- flamedoge 9y agoIt just feels hacky to do it the way author suggested. You can just invoke all the files in cmdline, swift *.swift to same effect I think.
- slavapestov 9y ago`swiftc * .swift` spawns one frontend job per file and then runs the linker to link together the .o's. `swiftc -whole-module-optimization * .swift` compiles all files in a single frontend job. Note that -O is independent of -whole-module-optimization, which is perhaps a bit confusing.