Engine optimizations

On my blog I have been covering a bunch of optimizations I have done to the engine. Most of the optimizations are already integrated on the 4.3 branch or master. I hope people find it useful:


Hi Pablo,

I love what you have written so far, thanks a lot for sharing all this with us!


Thanks! I’m glad you are enjoying them. BTW I just added a new article Unreal Engine 4 GPU particle system micro-optimizations. Part 2.

Great posts - I love reading these as I like optimization work but I’m too lazy to mess with that in the early process of making my game, since there’s so much gameplay work to be done (I working on the Dungeon Survival project - I commented on your blog before).

I appreciate the articles, too!

Dear PZurita,

Thanks for taking the time to share your research and code changes in such an organized and readible way (with pictures!)


I really like what you did with the AABB transform optimization!



Question for you Pablo:

What is your experience with the use of const, on variables or functions, as any kind of optimization?

Does it have any cpu time optimization benefit in your observations?

Does it ever help the compiler write better assembly code?


Rama, you might find this (somewhat old) stackoverflow questionhas some answers to your question.

From the above link (thanks JCoder!)

“In practice, I don’t think there are compilers out there that perform any significant optimizations for all kinds of const objects. but for objects that are primitive types (ints, chars, etc.) I think that compilers can be quite aggressive in optimizing the use of those items.”

“There is [only] one case where saying “const” can really mean something, and that is when objects are made const at the point they are defined. In that case, the compiler can often successfully put such “really const” objects into read-only memory…].”

I just cant get over this feeling that constness should be beneficial to the compiler :slight_smile:

Yet I read in so many threads people say it is not a significant improvement.

Yet my feeling remains that is actually beneficial to the compiler :slight_smile:

I am hoping to hear from about any sort of measurements he’s done on this subject, and anyone else for that matter who has done empirical testing on “const-ness beneficence” (has a nice ring to it, doesn’t it?).


As mentioned on that StackOverflow question there isn’t any improvement really. In optimized builds the compiler already does whatever it can do based on data dependency so the assembly generated is the same (or at least it is on Microsoft’s compiler and other compilers I have used such as SNC). The reason you can to use const correctness isn’t about performance but about being explicit about the intention of the code in terms of data changes. A more important type qualifier to use in terms of performance is restrict rather than const (where applicable).

BTW I added a new article to the series. Reduced CPU time by 50% on the top hotspot. Unreal Engine 4 GPU particle system micro-optimizations. Part 3.

Great new article Pablo, thanks for sharing!

Thanks for helping UE4 engine be even better!


I love technical insights such as these. Good learning material. Subscribed to the thread.

@Pablo, the particle Light node kills my performance (even just one!), might be a good candidate for ya :slight_smile:

I added a new blog post about optimizing the cooking of assets. Improvement of 3X on CPU time and 20% on wall-clock time when verifying which assets need to be built. Optimizing Unreal Engine 4 asset cooking. CRC.

If you got a simple scene that I could try I may be able to take a look. I would also need the specs of your machine.

Hah, wow! That’s crazy.

I’ll set up something tonight and confirm what I’m seeing - I’m using one of the Effects Cave fire particles I think, that gives the hit.

My rig (I can get CPU-Z shots, but I’m at work now):

i7 2600k (3.4Ghz)
780TI SC

Hi Pablo, Im need your help for understand which issue have my UE4.
These are my CPU consumption: 4.3.0 Preview New Empty Map, Range 22-26%

4.3.0 Preview The Cave Level with all settings on Epic, Range 16%18
4.3. Release New Empty Map All Settings on Low and Real Time off, Range 28-31% 4.3. Release When Compile the shader, Range 98-100%
4.3. Release In BackgroundMode, Range 0.5-1% 4.3. Release The Cave Level with all settings on Epic, Range 29-31%
Now, my PC is not a workstation but this big difference of consumption Its seem to be strange, I dont care of quality,if is possible to use much less CPU is a good compromise.
Thx for your help.

What you are using to measure isn’t that good. You would actually need to profile under the same condition and with a better tool. Optimally you would use VTune or some other high quality profiler, but you can try Very Sleepy which is pretty good I’m told.

Ok, I have donwloaded Vtune Free Trial and this is a result from the analyze

sadly this version of program dont have the option to save the project.
I have the project folder(in zip format)you can take a look at that,or you can tell me what you need and I can submit screens if are usefull to you.
Thx again for help.

You would actually need to do have to reproduce the exact same process with the same time on both versions and profile both to contrast the data and see where performance changed for your machine. In my case I haven’t notice any particular change when profiling. In any case having a higher CPU usage doesn’t necessarily means that it’s worse if whatever was happening on the previous version is now done with a lower wall-clock time. I think you would actually need to have some specific performance optimization knowledge to tackle this.

What you may want to do is ask Epic if it seems reasonable to have some kind of editor benchmark to keep track of performance across versions. I asked a question related to that on a Twitch stream and here is the answer: - YouTube I still think it would make sense to have some automated process to track performance regressions but I’m don’t know about enough about the editor to implement that myself and I already got some other stuff in my plate right now.