13

I am almost done coding my webapp-game. It runs on all modern browsers. However, I want to establish some minimum requirements for it.

Thus, I need a slow Mac. However, I don't have access to a slow Mac that has a modern browser (IE 9+, Safari 5+, Opera 11+, Chrome, Firefox 4+).

Using the tool mentioned in this question, I can simulate a slow Internet connection. I can use up plenty of memory easily. However, I have no clue how to simulate a slow CPU without resorting to underclocking.

Is there any way I can make my Mac's CPU slower temporarily without underclocking?

2

5 Answers 5

8

One solution is to use virtualization to have another instance of Mac OS X running on your computer. Many virtualization applications (such as Parallels Desktop) let you decide how much resources an instance can have (e.g. memory or cpu). Lion increased its support of virtualizing Mac OS X.

If you do decide to go with Parallels, there's a useful how to article describing how to set up an instance of another Mac OS X Lion.

4
  • Beat me by 20 seconds :)
    – penguinrob
    Mar 28, 2012 at 3:11
  • Seems like this is both the community's favorite and my favorite answer. Green check for you! Mar 28, 2012 at 10:28
  • 1
    In Parallels it seems like you can only limit the number of CPU cores but not the clock speed..
    – Timo Ernst
    Jun 8, 2016 at 0:07
  • Seems like you can throttle the CPU using CPUThrottle willnolan.com/cputhrottle/cputhrottle.html
    – Timo Ernst
    Jun 8, 2016 at 0:13
7

A good way is to use the command-line utility cputhrottle, which allows you to set a cap to how much CPU a given process is allowed to use.

Install it with (for instance) brew: brew install cputhrottle

Then choose how much processor percentage the process for your browser (and/or your browser tab content process) can use: cputhrottle <PID> <PERCENTAGE>.
You can find the process ID using the Activity Monitor app.

To terminate cputhrottle (which actively throttles the process for as long as it's running), press Control-C.

2
  • 1
    Looks like cputhrottle's forumula was removed from Homebrew on Feb 17, 2019 because it doesn't work anymore. Yosemite was the last version of macOS to support cputhrottle. github.com/Homebrew/homebrew-core/pull/36127 Mar 22, 2019 at 18:08
  • @sean Strange—cputhrottle seems to be working on my Mac, even though I'm on Mojave with SIP enabled. I might have ended up downloading it from elsewhere, though; have you tried getting it from the author's site? willnolan.com/cputhrottle/cputhrottle.html
    – Cykelero
    Mar 24, 2019 at 14:27
6

You could always install OS X in a virtual machine and set the virtual machine to have a slower processor, perhaps.

4

Run a few instances of yes > /dev/null &. Each instance will peg a core to 100%, so run one for each core. You could also try re-niceing the yes processes to a higher priority or lowering the priority the browser.

1

Add sleep cycles to the main loop or parts of the code that runs often is a good first step. Next, add some calculations that are slow / irrelevant. Depending on what you want to stress, you can also so some awkward pointer math or casting of variables to slow things down. This is an easy thing to sandbag when programming.

2
  • 2
    Thinking like a programmer. This is useful; however, I want to find the minimum clock speed at which the unmodified game can run. Mar 28, 2012 at 3:21
  • Even when you are an Apple developer and take code to their testing labs where you can run it on all manner of hardware - do build in a nice margin of error since many user machines perform far worse than a best case mac. Between system add-ons and modifications, ram issues, full hard drives, etc...
    – bmike
    Mar 28, 2012 at 3:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .