Visual Studio 2022 is 64 bit and compiles and runs UE 5.0 EA approximately 20% FASTER

For many people out there the cutting edge is about performance, speed of execution, speed of compiling Shaders.
Visual Studio 2022 64 bit takes 27 seconds, uses 1.1GB peak to load UE5 source and be ready to edit.
Visual Studio 2019 32 bit takes 2minutes 23, 630k Peak and takes 2 minutes 23 seconds to be ready
on a 16GB Win 10 latest build PC. You will need an SSD/NVRAM with at least 200 GB free to complete the latest build

UPDATE:- Visual Studio 2022 Preview has been updated and is according to the road map will be updated each month until final release.

UPDATE 2 A Fork repository to build Unreal 5 Early Access with Visual Studio 2022 Preview

I have built Visual Studio 2022 Preview is 64 bit and compiles and runs UE 5.0 EA
I can count fewer seconds initially generating a new project.
So this is how to build UE50EA2 using Visual Studio 2022 Preview

Download Visual Studio 2022 Preview
This has been a good project to fork a repository on GitHub of the original code to another branch.

Download Git Bash from Git - Downloading Package for Windows 10

To load the update branch in Git CMD point to the branch on GitHub with
$ git remote set-url --add --push origin https://github.com/jimshalo10/UnrealEngine-5.git
$ “git clone https://github.com/jimshalo10/UnrealEngine-5.git -b ue5EA-vs2022”

$ cd ue5EA-vs2022
$ setup.bat
$ GenerateProjectFiles.bat -2022

I tested this by disabling VS 2019, to make sure VS2022 Preview was doing all the work.

I have added extra code to see which Visual Studio is loaded
4>Found Visual Studio installation: C:\Program Files\Microsoft Visual Studio\2022\Preview (Product=Microsoft.VisualStudio.Product.Community, Version=17.0.31423.177)
4>Found Visual Studio installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community (Product=Microsoft.VisualStudio.Product.Community, Version=16.10.31410.357)
4>Found Visual Studio installation: C:\Program Files\Microsoft Visual Studio\2022\Preview (Product=Microsoft.VisualStudio.Product.Community, Version=17.0.31423.177)

When the build starts the status line is printed by UE5
4>Using Visual Studio 2022 14.29.30130 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.29.30130)
and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).

Download Git Bash from Git - Downloading Package for Windows 10
REM install Git command. The open it

C:\Users\Owner\source\repos> ren UnrealEngine UE50EA
C:\Users\Owner\source\repos\ue50EA>setup.bat

C:\Users\Owner\source\repos\ue50EA>
REM in Windows Explorer open the above repository path Right Click on UE5.sln and Select Visual Studio 2022 Preview
REM Visual Studio 2022 Preview opens in Solution Panel Right-click UE5 and Select “Set as Start-up Project”
REM in Solution Panel Right-click UE5 and Select Build.
REM My PC with SSD and 6 core processor,16GB Memory and 16GB page file Builds in 4712 seconds approximately 78 minutes.

When built Debug → Start without debugging.
I am getting about 20% improvement as everything is built as 64 Bit in Visual Studio 2022 Preview.

I have now found after using my hard drive has become very fragmented after loading and building. This is believed due to the Windows Defragmenter does seeming to be as efficient as the command line.

Use this method
Open the “x64 Native Tools Command Prompt for VS 2022 Preview” Right-click “More” and select Run as Administrator
then enter the command

defrag D: /H /M 16
I am defragmenting D: (1.8TB) at Normal priority using MultiThread = 16
I now use this every day/week. There is a massive boost to VS2022 when building off a hard drive.

There is a great performance improvement in building Shaders and converting Static Meshes to Nanite, possibly two seconds less. The Unreal Editor no longer has the 4GB memory limit. Therefore it can convert several hundred Static Meshes to Nanite in one command with the working memory of over 6GB whilst converting

The more people test this using the above procedure the more influence Unreal Engine 5.0 will have on Visual Studio 2022 final release, in terms of performance in compiling for Unreal Engine 5.0 and packaging of the final game.

Using Visual Studio 2022 Preview there is a significant performance boost for the Valley of The Ancient demo

I have received a request to identify all the patches applied to UE5EA to make the VS2022 Preview repository work.
Here is the Git Bash command

git grep -r -n --after=1 -i “@Vs2022” . > Vs2022patches2.txt

I have been asked how do I get updates on the original branch then set up your remote as follows check your remote
$ git remote -v
origin https://github.com/jimshalo10/UnrealEngine-5.git (fetch)
origin https://github.com/jimshalo10/UnrealEngine-5.git (push)
This will mean you get updates from the (ue5EA-vs2022) repository.

If you wish to go ahead and make your own unique version you will need the settings below. Please Remember you are now on your own and will not receive updates from my repository unless you git stash your updates.

$ git remote -v
origin https://github.com/EpicGames/UnrealEngine.git (fetch)
origin https://github.com/jimshalo10/UnrealEngine-5.git (push)
git pull origin ue5-early-access
You are going to commit these patches so an editor window will open
insert a line saying why “#seperate update which will allow unique changes”
Exit the editor and the update will take place.
Please Remember you are now on your own and will not receive updates from my repository unless you stash your updates

6 Likes

Keep in mind that the current Visual Studio 2022 preview does not contain an updated MSVC Toolset (i.e. the compiler is the same as the one in Visual Studio 2019). That will be added in the next preview (see https://www.reddit.com/r/cpp/comments/o28rf1/visual_studio_2022_preview_1_now_available/h26cz55/). Any improvements you’re seeing are purely because the IDE itself is more performant. It should not impact the performance of built applications (including Unreal Engine), unless you’re running the IDE at the same time.

I’m also using the 2022 preview, but all I’m doing is right-clicking my Visual Studio solution and clicking “Open with Microsoft Visual Studio 2022 Preview”. Other than that, everything works right out of the box for me, no noticeable bugs. I expect it to be harder to get the Unreal Header Tool to use the new compiler in the next preview.

Sorry, I’m a noob with Unreal Engine, but some of this post still applies to me as well. I installed Visual Studio 2022 Preview for pretty much the same reason, but I installed UE5 throught the Launcher. Unfortunately, it appears UE5 can’t find VS 2022 and since it gives me error: “No compiler was found. In order to use a C++ template, you must first install Visual Studio 2019”.

I’ll still be trying to compile the whole engine, but I want to know in advance if the performance improvement for the demo Valley of the Ancients is noticeable even compared to the official UE5 build.

Also, how can I use Visual Studio 2022 instead of 2019 for the project, will compiling UE5 in VS 2022 solve the problem?

Thanks in advance.

When you load via the Epic Launcher, you are using the Epic Launcher Pre Compiled Binary version, which I believe goes live with 5.0 EA " on 25th June?. I am building from the Git hub source not the zip file. I have already got VS 2019 loaded, and like @Knauric has said the complier probably shares with VS2019. When we moved from VS2017 to Vs2019 initially we need to have VS2017 loaded as well as VS2019, because some code was initially shared or pointers needed adding. I would in hindsight, load VS2019 as well as VS 2022.

The Valley of the Ancient relies on the faster graphics card than mine. However the code seems to run quicker and on a slower graphics card this is noticeable, but if I had a fast graphics card I dont know if it would be that much faster!.

My motive for all this has been to find any bugs or problems, which will get fixed quicker. The Visual Studio teams always want people with big projects to test, or try and break, the new compilers, and that’s what I like doing! :slight_smile:

2 Likes

Thanks for clearing up my doubts. Am installing VS 2019 now.

Hi @Knauric and @makuc I have made a new fork repository which will build and run in Visual Studio 2022 Preview without VS2019. I have updated the First post.
Thanks

1 Like

Hi,
My build fails with the following error:
CMakeCCompilerId.c.obj : error LNK2005: main already defined in Module.ResonanceAudio.cpp.obj
Can someone advice please?

Hi @PaGo, This is some sort of problem with the linker. I got around this by Executing a Right Click on UE5.sln Project and select “Set as Startup Project”.
Right, Click and Select “Clean” this will delete the corrupted projects.
Right Click on UE5.sln Project and select “Build”.
This should now build UE5. Got to Menu View → Select “Output” and watch the compiler building

Doesn’t work… can’t create c++ projects with VS 2022

Hi @Marius_Sheppard
This is a carry through from UE 4 where they wanted VS 2015/2017 installed. In UE5 they just changed the line from 2017 to 2019.
Now I will have to fix the problem in my VS2022 Fork.
I will report here when fixed. UE5 BP C++ code generator creates a blank BP C++ in VS2022 correctly.
This section is historic code so it’s hard to read.

In UE4 .24/27 if you don’t have 2017 installed you get the same problem, hence why the Readme.md was carried over from UE4 I assume.

1 Like

For anyone watching this thread who are unaware:

Visual Studio 2022 Preview 2 has been released, which includes updated C++ build tools (notably including the updated compiler).

3 Likes

Hi @Marius_Sheppard, There is progress with getting UE50EA2 to create C++ projects.
I now have VS2019, building C++ projects correctly. Previously there was a problem carried over from UE4 that needed VS2017 installed. I will now work on getting VS2022 compiling projects.

If you want to manually build with VS2022 go to your project.sln right-click open with VS2022. right-click your project.sln select “Build”, when built press Ctrl-F5, “Start without Debugging”

To all those following this thread please load the latest update Preview and look at the Notification bell symbol with a number that will appear. Click on the bell symbol and the Notifications windows will appear. Select and Click on the Visual Studio 2022 Preview and select “Start Update on Visual Studio on Closing”.

The debug symbols load is now so fast. The new compiler has taken 480 seconds of compile build time of UE50EA as its all 64 bit

For the Graphics Content designer, have a look at the new icons and send feedback when you create a new project in the VS2022 preview.
It’s awesome with Preview 2 my conversion of the Epic Marketplace Infiltrator example from UE4 to UE5 its 10GB project have to be held inside UE5. The total memory used was beyond 12GB whilst running the shader compilers, all eleven, as each shader compiler run completed another item appeared in the window.
Goodbye 32bit 4GB memory limit!.

Please load the UE5EA and build it from the source with VS2022 as described above.
We UE5EA group are building one of the biggest test projects for VS2022 Preview.

This is influencing the performance of the final version of VS2022, the MS Compiler Engineering teams are looking at the performance statistics for compiling UE50 and execution of the UE50EA code and the more people test this the better for the future of UE50

@Jimbohalo10 thank you very much for posting this guide and hosting the repository that works with VS2022 preview 2.

Last night after not touching the engine (or game dev) in a while, I installed VS2022 and build UE5EA from your repository and it seems to work (just getting home, need to mess around with it to be sure). One thing I noticed when building the UE5 solution is that seldom did my memory usage ever go above 2GB. The entire process took about 4 hours, is that normal? (PC is Ryzen 5 3600X 6-Core, 16GB Ram)

 ---------------------- Done ----------------------
  
      Rebuild All: 1 succeeded, 0 failed, 0 skipped
  
  1 build system warning(s):
     - License is invalid
  
  Total time in XGE executor: 14441.61 seconds
  Total execution time: 14621.10 seconds

Hi @Star_Dust ,
Yes , this is normal on this specification of machine, to decrease the speed compilation you need and Sold State disk and 32GB memory and possibly a 64GB pagefile.

That aside I am glad the build works ok for you, as your System is well below the minimum spec for UE50AE.
My system is below the recommended system specification as well, but with patience I managed to develop this

IMPORTANT UPDATE FROM VS2022 PREVIEW 3.1 IS RELEASED 21st August 2021

(https://devblogs.microsoft.com/visualstudio/visual-studio-2022-preview-3-now-available/)

I have been told by VS Preview Engineering that
Visual Studio 2022 Preview 3.1 has been RELEASED
Please go into Visual Studio 2022 Preview 2 and look at the bell symbol with a number that will appear. Click on the Visual Studio 2022 Preview 3 and select “Start Update on Visual Studio on Closing”.
When installed reopen UE5.sln with Visual Studio 2022 Preview 3.1

On UE5 .sln click “Clean”, Then “Build”, currently my PC take about 4300 seconds(78 minutes).
Please do the update and re-build, then build your project.

UPDATE
VS2022 Preview 3 automatically builds C++ BP project now
see Visual Studio 2022 Preview is 64 bit and compiles and runs UE 5.0 EA approximately 20% FASTER - Development Discussion / Unreal Engine 5 Early Access - Unreal Engine Forums

1 Like

I guess I’ll throw in my feedback and say that I was able to successfully upgrade the ue5 main Visual Studio project to compile native Visual Studio 2022 instead of being “ue5 (visual studio 2019)”
I didn’t even really need to do anything just right click on it and retarget it. I don’t really know if it’s any faster. Because I’m a little bit more distracted right now with trying to diagnose a an issue on the latest commit which was “dfae4dfb7ec0164b710efdf84185bcaa38e2fc01” so I went back a couple commits to this one to get it to successfully work “d670e221547c7f784597fecbed70d85abd943d15”. It was throwing up a weird couldn’t compile the world grid material thing when I tried to load my project shrugs. I know I just have to wait a couple more commits and I’m pretty sure it’ll just be fixed anyway so I’m not going to really be too upset about it.

1 Like

Are you sure it actually compiled with the new toolset? I’m under the impression Unreal Engine doesn’t invoke the compiler through Visual Studio’s settings, rather its invoked via the Unreal Header Tool. You should be able to see what toolset was used in Visual Studio’s Output window near the start of the build.

next time i build i’ll take note of what it says.

Hi @Marius_Sheppard @Knauric
I said of my VS 2022 fork problem with creating BP C++

This is a carry through from UE 4 where they wanted VS 2015/2017 installed. In UE5 they just changed the line from 2017 to 2019.
Now I will have to fix the problem in my VS2022 Fork.
I will report here when fixed. UE5 BP C++ code generator creates a blank BP C++ in VS2022 correctly.

I am pleased to report successful compilation and running using the new VS2022 Preview 5 RC 1, released 12th October.
The VS 2022 final Launch event is on November 8th 2021

In this test I have used the most complex BP Vehicle Advanced which compiles and runs just like UE5 all you need to do is Control + F5
Here is a picture of the BP C++ build where VS2022 Preview is automatically called WITHOUT any reference to VS2019 as it has been disabled.


Here is a picture of the code running

This is Windows Task manager running the VS2022 P3 BP C++
as an Unreal Editor Binary


Minor Update VS2022 3.1 and 37 patches from the original fork and built and working fine. If you need to Enable Live coding this works with VS2022 Preview 5/RC 1 as well

I have pushed the updates to my repository

git clone https://github.com/jimshalo10/UnrealEngine-5 -b ue5EA-vs2022

2 Likes

Yeah I talked about that in my post the ue5 main crash you have to go back a couple commits for it to work and that has nothing to do with the visual studio version and that’s just epic broke it lol which is something they do kind of often lol
Edit: I was going to inch my way up the commits and try to figure out which one was the last commit that ends up working perfectly fine. Might do that since there haven’t been any commits today