ProjectWT
Published in

ProjectWT

Don’t Do P5.JS on MacBook Air Or Any Laptop — Coding Tutor Explains

love this image. code available on my GitHub.

This week, I am once again being asked by a client to return and do some P5.JS. I am not sure how big or small this will get. However, it’s always fun to work on P5.JS.

It’s exhaustive. Tiring. Also, when it’s done, it feels good and I get to make a nice amount of chimi changas.

As I sat down to meet client’s requirements, a thought occurred to me. This blog is about that.

P5.JS is Processor Heavy

code is here on GitHub.

There is no other way to say it. Every time I meet a client, the first thing I tell them, is to never attempt to do ‘too much’ P5.JS on their MacBook. Most of my P5.JS clients are folks who are in marketing or creative fields. This one time, the client was a movie director.

P5.JS always brings a different, varied type of clients. Not the usual technology folks who make up my primary bread and butter.

The creative types, of course, use Apple products. As a massive Apple user myself, I understand the appeal. Apple products look cool, an air of premium and wealthy and all their devices — tablets, laptops, computers and of course, phones — work with each other like butter…and butter knife.

Unfortunately though, Apple computers really suck when it comes to processing power, especially if it involves heavy duty number crunching. I remember this one time, my main gaming PC had to go for repairs.

I installed Fortnite on an iMac. It was just awful! The game could barely run. Sometimes I make the mistake of installing a game from Apple Arcade on the iMac or MacBook. Again, just awful. I would say, when it comes to number crunching and creative stuff, the iPad is far more powerful than the iMac and MacBook.

Fractal Trees. Code on GitHUb.

P5.JS, unfortunately is not the most elegant and optimized library. I am not a computer design hardware expert. All I have is an experience of coding for over 22 years. Based on that, I can tell that, P5.JS problems can be sourced to JavaScript, which puts no limit on for loops.

I mean, there is no loop limit on how much you can loop.

I don’t think it does. Or, P5.JS bypasses these limits for the sake of its ’x frames per second’ rendering which is essentially a for loop that never stops. That means, if you are rendering a simple animation where you are drawing some cool particles, that already starts squeezing the computer’s CPU.

You add 100 more particles, boom, your computer is frozen, unresponsive or, worst case scenario, deep fried!

Note : Apple computers do have fantastic thermal design. So, they usually don’t deep fry.

Now, if you go back to my previous example about gaming, you will realize that the Apple Products (Note : I don’t own any of the new M1 Chip computers. All my computers are pre-M1), are just plain pathetic with rendering stuff, even if its simple JavaScript based stuff.

Particles. code, as always, on GitHub.

Now, the question is, what happens on a windows laptop?

Right then. The issues remain. I have run the same P5.JS code on a Macbook, iMac, Surface Pro, GTX 1060 and RTX 3060.

  1. Macbook Air and iMac — Just plain awful.
  2. Surface Pro — Better than above. Just a tad better. Bearable and can actually get some stuff done.
  3. GTX 1060 and RTX 3060 — Awesome, of course. I mean, I do Daz 3d renderings on these bad boys.

I reckon, on a windows laptop that is similarly spec’d and priced, you might get a 10 % or 20 % improved performance. Still not recommended though.

The Solution?

so many colors. It’s jatre man! code on GitHub

The solution is, if you are going deep into P5.JS (like how I am), please buy yourself a proper gaming PC.

I work as a full time freelance coding tutor. Hire me at UpWork or Fiverr or Stack Overflow. My personal website is here. Find more of my art at Behance and Unsplash. Also, I have a Podcast about everyday life. And, a 2nd Podcast, where I talk about freelancing.

--

--

--

I have been tutoring for a while now. I write some quick tips, tutorials and related topics here.

Recommended from Medium

Flatiron First Project Assignment

The Complete Guide to Using GraphQL in Node.js With Apollo Server

construction crane highlighted against a sunset sky

Managing auth state in your Angular Firebase app

Javascript Basic Data types

The Rise of Shadow DOM

Write Beautiful OO Classes with TypeScript

ReactJs Basic concepts.

Browser Local Storage

Is it local storage?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jay

Jay

Freelance Tutor — Coding, Generative Art and Photoshop. Full Name : Vijayasimha BR

More from Medium

Automating my Mac: Strava and Google Earth

process

3 steps to create an open-source project

Why did Apple remove the Touch Bar?

My 6 most helpful commands to only use macOS Terminal in future