# Very long compile times with ThinLTO on mobile platforms 

**URL:** <https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175>\
**Category:** Mobile\
**Tags:** unreal-engine, Epic-Pro-Support, question\
**Created:** [November 6, 2025, 5:36pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175 "2025-11-06T17:36:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 6, 2025, 5:36pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/1 "2025-11-06T17:36:33Z")

</div>

We’re seeing very high link times with ThinLTO enabled on mobile platforms.

It takes more than 2 hours on Android and more than 1 hour on iOS.

Here is the exact times for Android: (Wall: 9859.11s CPU: 18093.14s)

Without ThinLTO, the same machine links in a couple of minutes: (Wall: 21.42s CPU: 95.50s)

Is it expected behavior? If yes, I’m curious about when you are using LTO on Fortnite.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 6, 2025, 5:36pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/2 "2025-11-06T17:36:37Z")

</div>

**Steps to Reproduce**  
Run UBT with Test configuration with -LTCG -ThinLTO -AllCores with iOS or Android platform.

---

<div class="post-metadata">

**Author:** ![step\_jac\_eg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@step\_jac\_eg](https://forums.unrealengine.com/u/step_jac_eg)\
**Post date:** [November 7, 2025, 7:34pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/3 "2025-11-07T19:34:20Z")

</div>

Hi Jouan,

This is expected as LTO is a slow and heavy process operating on a large amount of code. Specifying a thin LOT cache directory may improve performance on subsequent runs, however, Fortnite doesn’t use of it in part due to performance and rather, uses PGO.

Best regards.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 7, 2025, 9:45pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/4 "2025-11-07T21:45:41Z")

</div>

Do you use PGO on all platforms or only on mobiles?

LTO is not prohibitively lengthy on consoles and Win64 (about 20 mins for us).

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 7, 2025, 10:01pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/5 "2025-11-07T22:01:06Z")

</div>

I heard through the grapevine that this is fixed in 5.7 thanks to UBA redirecting heap allocation to its own allocator.

Apparently, the slow down is caused by thread heap allocation contention with the Windows heap allocator?

---

<div class="post-metadata">

**Author:** ![step\_jac\_eg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@step\_jac\_eg](https://forums.unrealengine.com/u/step_jac_eg)\
**Post date:** [November 7, 2025, 11:26pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/6 "2025-11-07T23:26:38Z")

</div>

Hi Jouan,

It is my understanding that UBA has always had memory detours on Windows hosts. However, this does not exist on POSIX platforms (Mac/Linux).

Best regards.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 8, 2025, 9:05pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/7 "2025-11-08T21:05:27Z")

</div>

Also, Stephane, could you please confirm whether Fortnite uses LTO or PGO on iOS and Android?

I wouldn’t expect PGO to significantly change the timing here as it is still very expensive whole program optimization.

---

<div class="post-metadata">

**Author:** ![step\_jac\_eg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@step\_jac\_eg](https://forums.unrealengine.com/u/step_jac_eg)\
**Post date:** [November 10, 2025, 4:41pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/8 "2025-11-10T16:41:47Z")

</div>

Hi Daniele,

PGO is used on both iOS and Android for Fortnite. I do not however have metrics as to its level of effectiveness.

Best regards.

---

<div class="post-metadata">

**Author:** ![step\_jac\_eg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@step\_jac\_eg](https://forums.unrealengine.com/u/step_jac_eg)\
**Post date:** [November 13, 2025, 7:34pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/9 "2025-11-13T19:34:45Z")

</div>

It’s difficult to give exact figures on full build times with PGO enabled however, it should be significantly faster than LTO, at least under our internal usage patters.

Best regards

---

<div class="post-metadata">

**Author:** ![step\_jac\_eg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@step\_jac\_eg](https://forums.unrealengine.com/u/step_jac_eg)\
**Post date:** [November 29, 2025, 4:57am UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/10 "2025-11-29T04:57:56Z")

</div>

Hi Jouan,

There unfortunately isn’t official documentation however, here’s a quick step-by-step guide:

**Instrumented (PGO Profile) build:**

In your TargetRules:

```auto
public class MyGameClientTarget : TargetRules
{
    public MyGameClientTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Client;
        // For Android
        bPGOProfile = true;
    }
}

```

- Package and install to device.

- Run the app with a command line that includes where to write profiles:
- -pgoprofileoutput=“/sdcard/Android/data/\<your.package\>/files/PGO”
  - Exercise representative workloads (menus, matchmaking, gameplay loops) to collect meaningful coverage.

- Ensure clean shutdown to trigger PGO\_WriteFile()

UE will emit multiple numbered .profraw files (PGO\_WriteFile increments a counter).

**Merge profraw files:**

- Pull the .profraw files from device.
- Merge:

`llvm-profdata merge /path/to/*.profraw -output /path/to/profile.profdata`\* Place the .profdata file where UBT expects it, e.g.:

`<Project>/Platforms/Android/Build/PGO/MyGameClient-Android.profdata`

- or set the PGODirectory/PgoFilenamePrefix accordingly.

**Optimized (PGO Optimize) build:**

- In TargetRules:

```auto
bPGOOptimize = true;
bPGOProfile = false; // now using data rather than generating it

```

- UBT will add **-fprofile-use.** Compile/link will weigh hot vs cold paths using the profile data

Let us know if you encounter any issues.

Best regards.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 7, 2025, 11:44pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/11 "2025-11-07T23:44:49Z")

</div>

We’re compiling Android on Windows and it still takes more than 2 hours. We’re not using UBA though.

Are you saying that UBA would help here even on 5.6?

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 11, 2025, 10:28pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/12 "2025-11-11T22:28:47Z")

</div>

Can you share the link duration for your mobile PGO builds?

I’m trying to understand if it’s faster than LTO.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [November 25, 2025, 5:32pm UTC](https://forums.unrealengine.com/t/very-long-compile-times-with-thinlto-on-mobile-platforms/2688175/13 "2025-11-25T17:32:19Z")

</div>

Do you have documentation covering how to make a build instrumented for PGO and how to build with PGO once the profile is generated?

I couldn’t find anything besides a couple argument mentions in this doc: [https://dev.epicgames.com/documentation/en\-us/unreal\-engine/build\-configuration\-for\-unreal\-engine](https://dev.epicgames.com/documentation/en%5C-us/unreal%5C-engine/build%5C-configuration%5C-for%5C-unreal%5C-engine)
