Here something related in StackOverflow:
And there are lots of aspects to think about when choosing the language. For example, Processing (Java) provides a bunch of libraries that are not available when using Processing.js or p5.js. Which is true in the opposite direction: you can’t use the p5.js libraries in Processing. One runs in the browser, which is great to show your creation to anyone online. The other provides powerful libraries that you may need in your project, but then you are have to run the program in a local computer. Which is fine for an interactive art installation, for example.
One more thing, if you use shaders (GPU programming) then it doesn’t make so much difference which one you are choosing as sometimes you can even reuse the same shader program (with minor modifications) both in Processing and in p5.js, but not in Processing.js, because it doesn’t support shaders afaik.
About the example you posted: in my computer it runs much better in Processing than in the browser.