Codementor Events

How to Stop Squandering Your Precious Mac Development Resources

Published Aug 16, 2016Last updated Jan 18, 2017
How to Stop Squandering Your Precious Mac Development Resources

Let's cover some of the most effective ways to get more out of your Mac development environment to help increase your performance and capacity as a developer.

Introduction

How much money do you want to have in the bank?

If you were given the complete freedom to choose how much money you could have in the bank, would you choose to have as much as possible or something much less than the maximum?

Your development environment resources are like your money in the bank. The things I will discuss here are your CPU, storage, networking, and overall uptime. The more of them that get spent, the less you have for your development. When you have less resources, you have to spend more of your own time to make up the difference.

To save time and be more productive, I recommend that every developer seek to maximize their development environment resources (though the choice is entirely up to you).

You may not be pushing against the limits of your tools now. Trust me, as you grow as a developer, you will find that your tools will start to limit you one day.

It is also natural for your tools to lose their power with the advancing of technology. This often corresponds to a new version of Xcode. I’m being a bit facetious here but the point can be made that as technology progresses, it often uses more resources rather than less. This is because software and hardware are both constantly evolving to be more powerful.

I’m going to share some tips that I’ve collected over the years, in my more than 10 years of programming experience, to give you more resources that you can use for developing on your Mac. Having more resources means having more capabilities and opportunities.

A Little Background

The performance of macOS is tuned for the average user. Developers aren’t average users; we are power users. We have different needs from users who are less demanding on their computing resources.

As a Codementor, I’ve had the opportunity to work directly within many people’s development environments and I’ve seen first-hand how developers are not maximizing their development resources. Developers should maximize their development capacity not only for the sake of their mentors but for the benefits each person can gain from having a maximum quantity of resources at their disposal.

It’s like a game, the one with most resources has a better chance of winning. We can optimize our environment to waste less of our precious resources; but every optimization involves a trade-off in some way. For example, optimizing for higher speed often involves a trade-off of greater memory usage. This guide that I’m presenting is for the sake of minimizing the trade-offs and maximizing the gains in a balanced and easy way.

Save Your CPU

Let’s start by maximizing the brain of your computing environment, the CPU. Reducing excess CPU usage can save your fans needing to go into overdrive to blow off the extra heat.

Save CPU by Turning Off Extra Graphic Effects

No matter how fast your CPU is, there is a cost to using extra graphic effects that don’t contribute to the function of your interface.

By default, macOS uses transparency effects that are purely cosmetic. Disable these effects to recover the CPU usage that goes along with them.

Tip Turn off transparency effects for maximum CPU performance.

They can be turned off in the Accessibility pane under Preferences.

How to Reduce Transparency Effects

The trade-off for reducing contrast is that the interface will look plainer.

Save CPU by Not Encrypting Your Entire Drive

Even though the effect of FileVault 2 on overall performance is very low, that is not the same as zero.

Tip If you don't need FileVault 2, don’t use it so that you conserve an extra bit of CPU capacity.

The trade-off for not using full disk encryption is that your files will not automatically be protected by encryption.

If disk encryption is required, Sparse Bundle Disk Images can be a viable alternative that will give you more control over what, and how to encrypt than FileVault 2.

Save CPU by Preventing Unchecked CPU Activity

Optimizing your development environment for performance isn’t going to be helpful if you are giving away CPU power in the background. You can monitor CPU activity using Activity Monitor.

Sometimes apps have bugs that cause unnecessary CPU usage. Having a monitor for your CPU resources in your menu bar can aid in recognizing when this happens. iStatsMenus is such a utility and can be extraordinarily helpful in gaining intuition about CPU usage.

You might be surprised when you find that a process has been stealing CPU cycles without you ever knowing about it.

Do Not Get Disturbed by Notifications

Perhaps the expense on computing resources of notifications is minimal but the impact on your attention can be much higher.

Tip Disable notifications using Do Not Disturb if you want to be able to focus on a task.

The trade-off is having to check for notifications manually later.

Notifications can be disabled for extended periods by setting the start and end time that notifications should be allowed. Make the start time equal the end time and "Do Not Disturb" will always be enabled.

If I am doing a mentoring session or recording a screencast, the last thing I want is for an unsolicited notification to pop up.

Save Your Disk Access

Save Disk Access by Having More Memory

Disks are slower than memory. macOS spends a huge amount of time accessing physical storage. With less memory, this is especially so due to a greater need for accessing virtual memory when physical memory is insufficient.

My recommendation is to have a minimum of 16 GB of RAM for development, especially with Xcode. Having more memory than this only helps and gives you the additional opportunity to run more tools like virtual machines.

Macs all have physical RAM limits. Here is a link to a useful guide for finding the actual maximum RAM that your Mac can use. Being able to afford the largest memory modules available is another matter.

Tip Increase your RAM because it can help reduce disk access that can slow you down.

The trade-off for higher RAM is higher monetary cost.

Save Disk Access by Getting a Faster Drive

If you don’t already have a solid-state drive for your main disk, get one now. Along with increasing memory, it gives you one of the most immediate gains in performance that you can achieve for your development environment.

Tip Use a solid-state drive for your main drive to minimize delays incurred by disk access.

Drive performance can be tested with utilities such as Blackmagic Disk Speed Test.

The trade-off for a faster drive is higher monetary cost.

Save Disk Access by Using RAM Disks

Xcode maintains temporary storage for each project known as Derived Data. It is actively used during development , which includes building and compiling your project. Since it is such a frequently accessed resource, moving its contents to a RAM disk can increase the performance of your development environment, significantly. If you don’t use Xcode, there are equivalent performance tweaks for other apps.

Tip Use a RAM disk for Derived Data for the fastest build times in Xcode.

I’ve written an article that includes a link to an open-source script written in Swift that performs the steps needed to setup a RAM disk to be used for Derived Data in Xcode. It not only provides a performance increase, but it also ensures that you will have a fresh DerivedData directory every time you mount the RAM disk.

It serves as a seamless replacement to the DerivedData folder on your physical disk. The location of Derived Data can be viewed in Xcode’s preferences.

Get the Location of DerivedData in Xcode

The trade-off for using a RAM disk is having less free RAM.

Save Disk Access and CPU by Scheduling Time Machine

Another performance drain that can be easily eliminated is the default Time Machine schedule. It is designed to perform a backup every hour. In my experience, this is far too frequent when maximum resources are needed during development.

There is a free app called TimeMachineEditor that allows flexible scheduling of Time Machine backups. I highly recommend using it.

Tip Prevent Time Machine from eating up your development resources including CPU and disk access by setting its schedule.

The trade-off for changing the Time Machine schedule is that backups will be less up-to-date.

Reduce Your Downtime

Another option to save the resources used for backups would be to skip them altogether. However, that would be incredibly foolish as the downtime that can be saved from a good backup is immense, but only if you can actually restore your data from the backup.

Tip Test restoring from your backup ahead of time.

The trade-off is the time it will take you to verify that you can restore from your backups.

There are other aspects of computing that you can also choose to do to limit downtime that may occur due to common failures. For example, wireless devices are appealing due to not having cords that get tangled up in everything but their trade-off is that they are less reliable.

Save Downtime by Using a Wired Keyboard

After having gone through a couple of Bluetooth keyboards, having to pair them over and over again, I decided that even a single incident of a lost connection was dragging down my developer productivity.

Lost connections mean lost time. If it happens once it may not seem like such a big deal. After 10 times it starts to become a hassle. Any more than that and you will be ready to toss that keyboard out the window.

Tip Get a wired keyboard so Bluetooth connection losses and battery replacements are a thing of the past.

The trade-off is the monetary cost of a wired keyboard.

Save Downtime by Using a Wired Network Connection

Wi-Fi can be so convenient and it also eliminates wiring, but when it comes to maximum development performance, it is usually not as fast as the wired connection on your computer and is more prone to interruptions.

Tip Use a wired Ethernet network connection for maximum network performance and minimal downtime.

A reliable bandwidth tester can be found at Speedtest.net

The trade-off of using wired network connections is that cabling is required.

Maximize Your Overall Performance

When every ounce of capability counts, desktop Macs will outperform MacBooks due to the compromises needed to make a portable computer. A great chart of benchmark results can be viewed with the Geekbench Browser. They can give you a way of quantitatively comparing the performance of different Macs.

Tip Choose a desktop Mac for maximum overall performance.

The trade-off is reduced portability if you don’t also own a portable Mac.

Summary

By always seeking maximum performance out of your tools, you will carry that attitude over into your programming and that is one way to be a step ahead of other coders.

There is a point of diminishing returns where the trade-offs start to outweigh the gains. Knowing the right balance point for optimizations is something that will come through experience and testing.

Here is my summary on how to maximize your development capacity.

  • Increase memory to at least 16 GB or more, if possible.
  • Use a solid-state drive (SSD) or get a faster SSD.
  • Use a RAM disk when possible. Xcode’s DerivedData can run entirely out of a RAM disk.
  • Choose wired devices when possible.
  • Reduce downtime by testing your backups.
  • Choose desktop Macs when overall performance counts.

I’ve highlighted several examples on how the resources in your development environment can be increased and maintained at a higher level. What do you have to gain from all this? Higher productivity and more time.

When you can finish more work in less time, you will make yourself more valuable as a developer. You will have the choice of making even better software or have more time do other important things. As a mentor, my wish is for you to find that perfect balance, for yourself, between writing code, and the rest of life. Having more resources available in your development environment can make finding that balance easier.

Discover and read more posts from Daniel
get started