Should I upgrade from my 2013 MacBook Pro (mostly concerned with compile times)?

Hello,

I currently work on a late 2013 MacBook Pro (processor: Intel(R) Core™ i7-4850HQ CPU @ 2.30GHz, SSD storage, 16GB RAM). I’m getting very frustrated with the compilation times, as well as the delays switching between editor and play mode. I’m already using MAD compile time optimizer to put our copious third party scripts in the Plugins folder, but I’m still facing 20-40s compile times, as well as 10s play mode startup and 5s for returning to edit mode. This is killing my productivity both by directly wasting my time when I test, debug, and tweak my scripts, as well as keeping me out of the “zone”.

So I’m wondering how much room there is to improve my setup. My best guess at this point is that the CPU is the bottleneck (as well as the fact that our project has loads of assets but I can’t help that). If I’m going to upgrade, I’d prefer a Windows desktop PC. I’m pretty confused, however, by the various CPUs available today, with all the multi-core options etc. Especially as it’s not clear to me if Unity is even using all my four cores for compilation. This site seems to suggest my CPU is still pretty good, but are the times I listed really just something you have to accept while developing with Unity? So any advice would be appreciated!

Best regards,
Tommi Horttana

1 Like

20-40 seconds should not be happening on an i7.

There’s an old thread here that goes through ways to reduce compile times. The tl;dr is:

  • Don’t use UnityScript, as it’s really slow to compile compared to C#.
  • Move chunks of the code base to dll’s.

I dont think this is the issue, Unity always seems slow on MacOS compared to Windows…
Even with most powerful Mac out there, Unity compile times seems same, its like it does
not use the hardware fully…unity will not comment of course…

I’ve never owned a Mac (only virtual machine Macs), but also build times depend on platform. Android seems to build much slower than Windows.

If you are going to get a Windows PC, there’s so many options so you need to choose carefully. You can build a PC yourself (not as hard as you think), or get a pre-built system. There’s a huge range of options so you’ll need to set a budget, then get the best CPU, GPU, RAM, SSD you can.

However as others have said, your CPU is decent, so it could just be poorly optimized scripts in your project. Also in my experience, spawning lots of objects at runtime will slow down play-to-edit mode time. Still, after playing once, I wait a maximum of 2 seconds to start play mode.

Finally, did you try Windows Bootcamp? If not, you can try it for free, as Windows can be installed without a key as a 30-day trial. However it would be strange if the OS would cause such long wait times.

Thanks for the responses, everyone!

I’ve looked into this more since my post. The bottleneck is definitely the CPU. The biggest problem is that Unity compiles in a single thread (and, as far as I can tell, when starting a scene), so it only uses 1/4 of my full processing capacity. And according to a friend who knows these things, I could get about twice as much single-threaded computing speed if I bought a desktop computer with the newest processor. Which is definitely tempting.

I’m aware that our project setup contributes to these delays. The problem is that we use loads of third party asset packages, which means thousands of C# files to compile. (We do not use UnityScript, apart from one very small third party package.) I’ve already put all of the third party packages in the Plugins folder but that only takes the compilation time down from 40 seconds to 20 (and for some reason that’s not always reliable). There may be other things we’re doing wrong somehow, but I don’t know where to look (I’ve tried). And I’m wary of the idea of turning third party asset packages into .dlls. At the very least it would make updating difficult and would break all the script assignments we’ve already set up…

Are there any other ways my scripts could be poorly optimized? As for the play mode delay, it seems to happen even in en empty scene, so it’s not all the game objects I spawn (I spawn about 30).

It sounds promising that Unity is faster on Windows. I wonder if that would make it even better to get a Windows desktop. Though it certainly is using 100% of the CPU time of the one CPU that it does use, and I don’t think it would utilize multiple processors on Windows either… I do have Windows boot camp (Windows 10 is actually completely free, no trials or anything, just a couple of missing customizations I don’t care about). I guess I could try it…

Come to think of it, Bootcamp does have a performance loss, so don’t judge Windows based on that.

Since you’re compiling thousands of files, I’m afraid there’s not much you can do except get a higher-clocked CPU.

I’m not sure if Unity uses only 1 core for compilation. I opened the Task Manager, waited for the CPU to level out then hit the play button in my scene, and exited play mode. Here’s the graphs:

3075271--231369--upload_2017-5-18_16-3-40.png

As you see each core spiked differently, but only a few stayed the same while others were doing varying levels of work. Interesting…

If you’re going to get a new computer with CPU, in your case you probably want a high-clock-speed quad-core, since as my graph shows, Unity doesn’t use all cores (but doesn’t use 1 either).The latest i7s clock really high (7700K does 4.2-4.5GHZ, 6700K does 4 - 4.2, 4790K does 4 - 4.4GHZ). If you put on a $50 water cooler you could do serious overclocking (I use the stock Intel cooler since mine doesn’t overclock).

Or you could go the DLL route, but that has its own set of challenges that you listed.

Actually, DroidifyDevs, your findings are similar to what I’ve discovered: The CPU consumption is equal between all my 4 cores, but each only uses 1/4 of its capacity. And the CPU consumption of the Unity process is pretty much exactly 100% of one core’s capacity. Your graph also shows no CPU topping out (they seem to combine up to 130% but that might be inaccurate reporting or some other programs contributing as well. So I believe Unity is still single-threaded, for the most part at least, and the OS is simply distributing the work in a non-parallel manner, basically making the cores take turns doing the work.

Well, I bought (with return option, fortunately) a new PC with the i7 7700 (I probably should have gotten 7700K but the maximum speeds are not that different - 4.2GHz instead of 4.5). But I only got a 15% reduction in compilation time vs my Macbook Pro 2013. Given the Turbo Boost of MacBook Pro seems to reach around 3.2GHz (out of the advertised 3.6GHz) while compiling, I would expect a 25% reduction. The prebuilt computer I got only has 8GB or RAM (the Macbook has 16GB), but it never seemed to reach more than 80% consumption during the compilation. Does anyone have an educated guess as to whether the RAM is relevant if no virtual memory is being used (I’m pretty sure it isn’t being used)? I’ve read about disk caches - the OS using RAM instead of disk to read and write files. But is that any use for compilation? I’d think it wouldn’t matter because the files the compiler write will always have changed. And the files written are only a couple of MB anyway…