Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

LLVM_LTO should be enabled for all configurations and not just Release/ReleaseWithSymbols #12669

Closed
mb12 opened this issue Aug 19, 2018 · 6 comments
Labels
build Core The cross-platform C++ core, aka mbgl needs information

Comments

@mb12
Copy link

mb12 commented Aug 19, 2018

Is there any reason to disable LLVM_LTO for debug configuration? I do not notice any preceptible degradation in link time when enabled for debug configuratio.

Expected behavior

Link time flags should as close as possible between debug and release builds.

Actual behavior

LLVM_LTO is disabled for debug configuration.

Configuration

Mapbox SDK versions:
iOS/macOS versions:
Device/simulator models:
Xcode version:

@kkaefer
Copy link
Member

kkaefer commented Aug 20, 2018

I do not notice any preceptible degradation in link time when enabled for debug configuratio.

I can't confirm this. I used mbgl-glfw to measure the link time. Linking Debug without LTO took 1.8 seconds, while linking with LTO took 83.9(!) seconds. When you tested this, did you recompile all files with -flto? If they don't have LTO information, the linker can't use it during linking so it'll likely not affect link time.

@kkaefer kkaefer added build Core The cross-platform C++ core, aka mbgl labels Aug 20, 2018
@jfirebaugh
Copy link
Contributor

Yes, LTO definitely increases the link time significantly.

@mb12
Copy link
Author

mb12 commented Aug 20, 2018

@kkaefer I tested mbgl-core, static, dynamic, iosapp targets. There is no need for configuration specific Link time options for these targets.

Also the recommended LTO option Is incremental by Apple. Have you tried using LLV_LTO:incremental with mbgl-glfw? The LLVM project uses this option itself for the final link step precisely because monolithic LTO is slow.

@jfirebaugh
Copy link
Contributor

Yes, see #12502 (comment).

@mb12
Copy link
Author

mb12 commented Aug 20, 2018

@jfirebaugh Where do you see the massive increase in link time for iosapp or its dependencies? I enabled monolithic LTO in Xcode for these targets.

@mb12
Copy link
Author

mb12 commented Aug 20, 2018

@jfirebaugh Having the same link time switches between release and debug bits would be preferable(esp a link time option that is not default.). But if there is a 50x degradation in link time then it’s not worth it. Thanks for looking into it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Core The cross-platform C++ core, aka mbgl needs information
Projects
None yet
Development

No branches or pull requests

3 participants