Optimizing for Flutter development

I use a MacBook Pro 13 (2017, 8 GB, no touch bar), and everything seems so slow: typing is laggy, running the projet in the emulator freezes the computer for a good minute, clicking in the emulator misses half the time, so I have to click several times for it to register one tap, etc.

Reasons

  • Android Studio and the emulator eat up my 8GB of RAM and then some. It constantly uses 1 GB of swap too.
  • I run all the unit tests as part of a pre-commit hook.
  • Every deploy takes 3 minutes for Android, up to 10 for iOS. During that time I can barely browse the internet.

Workarounds

  • Try using Visual Studio Code for coding, and use an actual device for testing. In which case I'd want to use it over wifi. To do so, I have to first connect over USB, run adb tcpip 5555, then I can disconnect it from usb, and adb connect 192..... to the device.
  • Move the heavy unit tests and associated code to a separate library. This code does not change much. No reason to run it all on every commit.
  • For deploying, there's no way around it so far. I guess I can simply do it at the end of the day when I don't need the computer anymore.

Help from the tools

  • The Flutter team is planning a native desktop emulator, which would use much fewer resources than the emulator. (Can't seem to find the post now). I tried the experimental Flutter Desktop Embedding but it would require extra work to make it work. More precisely the Google Sign-in is missing an implementation for desktop.
  • The Flutter team is planning better compilation performance. They also mentioned better use of multicore processors. Blog post

New hardware?

I am using a MacBook Pro 13 (2017) which has a multi-core score of 9k on GeekBench. The MacBook Pro 13 (2018) scores 18k, the MacBook Pro 15 (2018) scores 21k. Finally the Mac Pro (2013) scores 23k and the iMac Pro (2017, 8 cores) scores 31000. See it on GeekBench. But that stuff is expensive. See for yourself:

Model GeekBench score (thousands) Price
MacBook Pro 13 (2017) 9 $1.0k
MacBook Pro 13 (2018) 18 $2.0k
Mac Mini, 4 core, 16 GB RAM (2018) 20 $1.1k
MacBook Pro 15 (2018) 21 $3.0k
Mac Pro (2013) 23 $4.0k
Mac Mini, 6 core, 16 GB RAM (2018) 24 $1.4k
iMac Pro, 32 GB (2017) 31 $5.6k

Rumors say that a new Mac Pro will be released in 2019 (link). And the 2019 MacBook Pros should also get more powerful as usual. Looking forward to getting one of those!

And one thing that stands out. The Mac Mini is really cheap, and more powerful than a MacBook Pro 15!