My 8GB Mac became painfully slow while browsing: here’s what I did
Bloated websites loading dozens of third-party services for tracking and advertising are the main reason I can no longer work with my otherwise speedy Macbook Air M2. It only has 8GB of RAM, and several Chrome tabs are enough to fill those up. But I found a few solutions.
Nothing is more annoying than a slow computer, lagging even on mouse movements and keystrokes when you’re trying to get your work done. How could this happen with a new Apple device?
The MacBook Air, with its M2 processor, can handle a lot, but its base 8GB RAM means that it has no capacity for even casual contemporary web browsing demands. No matter whether it’s on Safari or Chrome (statistics show that many Mac users still choose the latter), the problem persists.
And such systems are often chosen by companies for their employees.
I’ve been fighting with my sluggish Mac for a while. Then I heard that my colleagues also had the same problem, with some even seeking replacement computers because of it.
On a global scale, countless Macs boasting a mere 8GB of RAM are in circulation. The production and sale of these systems, coming without the ability to upgrade, could be deemed irresponsible and contributing to electronic waste. Here are the options that I found to extend the lifetime of a Mac.
TLDR: use an ad blocker, as the largest strain on a computer seems to be web trackers, ad services, and other bloatware. If you’re an advanced user, consider editing the Hosts file.
Is 8GB enough in 2023?
“Yes and no. What’s definitely true is that a lot of modern-day programs are optimized for larger amounts of RAM – meaning that, whilst running a single program on its own might be fine, if you want to run multiple programs at once, you might start to run out of room,” said Steven Athwal, managing director of The Big Phone Store, the UK's biggest refurbished mobile phone seller.
A simple answer, “don’t run more than a couple of programs or tabs at once.” Sadly, for many people, this is just not realistic.
“And to make matters worse, websites these days can be just as resource-intensive as an entire program – meaning that every single Chrome tab you have open is putting a heavy strain on your relatively limited machine,” Athwal explained.
While organizing your apps and tabs is always a good practice, there’s plenty more you can do.
I found three fixes that worked: the “easy and ugly,” the “easy and good,” and one for advanced users that was also effective without relying on third parties.
The problem: subframes hog resources
No detective experience is required to understand where computer resources are being used. The Activity Monitor (Task Manager in Windows) leads to Google Chrome. But Chrome itself doesn’t deserve all the blame.
Chrome’s inbuilt Task manager reveals that most CPU/memory resources are hogged not by websites directly, but by tracking or ad services that are loaded from third parties.
In my case, “Subframe: https://pubmatic.com/” seemed particularly aggressive with constant 20-100% CPU usage and hundreds of megabytes of RAM. Killing this single instance made the computer usable again.
But dozens more subframes were running ad systems from Google, Criteo, Amazon, etc. Each of them requires more megabytes and CPU cycles.
A subframe is a separate HTML document embedded within the main HTML document of a web page. It's often used to include content from external sources, like ads or widgets, while keeping them isolated from the main page's content.
When you see this entry in the Chrome Task Manager, it means that the main web page has embedded a subframe that is fetching content from the specified URL.
“Pubmatic, and similar processes within Chrome, are ad servers: they manage the advertising on the page. Killing them shouldn't have a negative effect, except if the site requires you to watch an ad before you can access certain content,” Athwal explained.
For my tests, I opened 50 websites in 50 Chrome tabs without changing anything else. It is not an unreasonable workload. My journalist’s work routine is opening many websites at once to check for news and updates and keeping a few dozen tabs open all day.
This is how my memory looked “before” any changes with 50 tabs open. RAM is fully utilized with an additional 5.3GB Swap used. To put it simply, Swap is used when the computer runs out of RAM – the excess data is moved to a storage device (SSD) which is much slower to write and read.
Experiment 1 – do not repeat this method
While trying to find a way to relieve the computer’s memory pressure, one of the first things online that you might find is a strange tip on Reddit – disable the Chrome flag “chrome://flags/#site-isolation-trial-opt-out.” Disabling this option decreased the Swap used by more than 3GB with the same 50 tabs opened.
However, it also leaves your computer much more vulnerable. Do not use this!
Site isolation is a security feature to protect from attacks such as Spectre and Meltdown, cross-site data leaks, and some types of malicious code execution in the browser.
“Yes, that does speed up the computer, but then all your tabs are left vulnerable to bleed data to other tabs. Disabling the site-isolation feature might compromise your browser’s security and expose your data to leaks and malicious attacks. You do not want to compromise your security for marginal speedup in browsing,” Vincentas Baubonis, Cybernews security researcher, warned.
Experiment 2: the hero we need – an adblocker saves the Mac
Simply adding an adblocker (Chrome extension) achieved the best results in freeing up computer resources. After trying a few alternatives, I stuck to open source “uBlock Origin” as it had a very powerful effect out of the box – not a single subframe, causing troubles, was loaded.
On the one hand, I understand website owners and how they depend on ad revenue. I have nothing against viewing a few ads. But I cannot afford to view ads when ad and tracking engines consume more computer resources than the websites themselves. It’s a choice between being able to do my job and not.
With the same 50 tabs opened, the RAM was still fully utilized, but the Swap used was less than 1GB. The computer was noticeably speedier.
However, there is one problem. Just recently, I wrote about the risks of Chrome extensions. These can track all your online activity, and if an attack appears somewhere in the supply chain or the creator is not reliable, that leaves users vulnerable. Each extension can become an additional risk factor, even if it is open source. But it works, so I am back to using at least one extension.
“The way to block ad servers from loading is, as you've discovered, using an ad block service like uBlock Origin – although this comes with a small downside. For most websites, these are how the site makes money, so sometimes sites will be programmed to stop working properly if they detect that you're using an ad blocker. If a site won't work properly with the adblocker turned on, you can always disable the adblocker just for that specific website,” Athwal said on the findings.
Experiment 3 – for advanced users
Now, I still was not convinced about relying on third-party products. It might be a case of paranoia really kicking in after working closely with cybersecurity experts, or it might just be common sense.
Browser-level controls are the best way to limit resource-hungry code from implementation. However, if you want to leave the browser clean without extensions and have a working solution for all browsers and apps on the computer, you can add exceptions to the Hosts file.
As I noted earlier, just a handful of ads and tracking services can significantly contribute to CPU/memory usage.
The Hosts file allows the redirection of certain services to different IP addresses. The computer then does not check the DNS server and relies on your entry, like in a phonebook.
Modifying Mac's Hosts file lets you block access to specific websites.
For that, you need to use the Terminal app. (You can find it in the Application > Utilities folder, or just search for it using Spotlight, or Launchpad > Other).
Backup first (this command would save the Hosts file copy on Desktop):
sudo cp /etc/hosts ~/Desktop/hosts_backup
To restore the Hosts from your made backup you would use it backwards:
sudo cp ~/Desktop/hosts_backup /etc/hosts
To open the Hosts file, type the following command and press Enter:
sudo nano /etc/hosts
Now, you can add anything here that you don’t want your Mac to load. Adding URLs of third-party services like Pubmatic, AWS, or Criteo with an entry pointing to 127.0.0.1 would effectively prevent your computer from connecting to those services.
For example, if you notice in Chrome Task Manager many resource-hungry subframes from the website example.com, you can add a single line, using arrow keys to move the cursor to the end of the Hosts file:
The IP address "127.0.0.1" refers to the loopback interface of your computer, or, in simpler terms, it's a way for your computer to talk to itself. When you set a website or service to use "127.0.0.1" as its IP address in the Hosts file or other configurations, you're telling your computer to access that website or service on itself without actually going out to the internet. Setting the IP to 0.0.0.0 would also work.
Press Ctrl + O to save the file and then Ctrl + X to exit the text editor.
A simpler way to manipulate the Hosts file may be by single line commands directly from the Terminal (you’ll still need a password).
To add a website:
echo "127.0.0.1 example.com" | sudo tee -a /etc/hosts
To remove the same entry from the Hosts file:
sudo sed -i '' '/127.0.0.1 example.com/d' /etc/hosts
What I finally did was even simpler: You can find already prepared Hosts files online, including known malicious, tracking, or advertising websites.
I downloaded one file with hundreds of entries and reviewed it with a text editor (TextEdit) to ensure they all redirected to 127.0.0.1 and not some strange or malicious IPs. Also, I double-checked if there were no important websites that I use, like google.com, for example. For tests, I used the edited website list from adaway.org, but be careful while downloading files online.
With a backup in place, I just copied the newly prepared Hosts file from Desktop using this command in the terminal:
sudo cp ~/Desktop/very_cool_hosts_file /etc/hosts
The result: Without an ad blocker, the RAM was full with more than 1 GB Swap used. It is worse than using just an ad blocker, however, the Macbook was still faster and more usable. Memory pressure was not turning “red” and stayed in the “yellow” zone.
With this method, I noticed Chrome still loaded subframe instances of redirected third-party services. They used some RAM, but less than before, no traffic could go through those subframes, and they were not using CPU cycles.
Finally, I enabled the ad blocker again and restarted the computer.
Here is how the memory pressure looked with the same 50 tabs open, uBlock Origin enabled, hosts files edited in combination, and nothing else changed:
My base Macbook Air model now even has some room for more programs and Chrome tabs to open. Voila.
The problem is not specific to Macs. Chrome works in an almost identical way on Windows, so if lack of RAM is an issue, consider using an ad blocker or adding exceptions to a Hosts file there.
Keep in mind that modifying the Hosts file can potentially affect other network-related activities, so use this method carefully, and be sure that you’ll be able to restore the file from backup or other means.
Also, please be aware that blocking certain domains, including third-party services, through the Hosts file or by ad blocker can have unintended consequences.
Many websites rely on these third-party services for various functions like analytics, content delivery, tracking, and more. Blocking some services could potentially break some functionality or cause websites to load incorrectly. You won’t see ads and won’t contribute.
At worst, badly configured Hosts files may lead to website inaccessibility or even redirect you to potentially malicious clones. Attackers often manipulate their victims' Hosts file to direct them to phishing sites or other forms of cyberattacks. So be very careful what you add to the Hosts file.
More from Cybernews:
Subscribe to our newsletter