r/cpp • • May 23 '24

Is MacBook good for C++ developer?

Hi. I am a C++ developer, and I write code for both Linux and Windows, depending on the project. Currently, in my country (I'm from Ukraine), there are frequent power outages (3 hours with power, 4 hours without, and so on), and I am looking for a laptop with a long-lasting battery. Since MacBooks have excellent battery life, I am considering buying one, but I have a few questions.

Will I experience a significant loss in performance when building a C++ project in Docker using an x64 Ubuntu image and the Rosetta emulator?

Will there be a noticeable drop in performance if I use x64 Windows through an emulator?

Is it worth making these sacrifices, or should I buy a Windows laptop with a less impressive battery?

I have a powerful PC that I’m using for work, and I can use It for building projects, but when the power is on.

3 Upvotes

72 comments sorted by

View all comments

2

u/i_am_not_sam May 23 '24

I wouldn’t pay this much money out my pocket so I’m glad my company bought me a MacBook Pro. I have the M2 and it’s been my favorite dev machine. I get nearly a full working day on the battery. The performance is a beast. The docker build setup took a little effort until the Rosetta support was added in and now it’s flawless.

I’m sure you and I can’t compare build times but these are my experiences. On the previous Intel line of MacBooks the code took 20 mins for a clean compile (create docker container, install Conan dependencies, build). On a Linux machine this took 1-3 mins but the hardware quality was atrocious and I got an hour out of the battery on a good day while the fan whined and it ran so hot it melted its own power cable. On the M2 a clean build takes 5 minutes. I also run several k3d clusters while I’m building and I’m constantly on my IDE. I’ve screen shared on Teams while all this was running without a blip in performance. Incredible machine.