processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.62k stars 3.31k forks source link

Slow since version 1.0 #6743

Open peeter2 opened 9 months ago

peeter2 commented 9 months ago

Most appropriate sub-area of p5.js?

p5.js version

1.9.0

Web browser and version

all

Operating System

all

Steps to reproduce this

The performance is still slow. I have created a speed test sketch that performs really fast on versions older than 1.0.0. It is very fast on version 0.9.0 for example as in this example: https://editor.p5js.org/shangtsung/sketches/j080fh87C

And it is very slow on every newer version starting from version 1.0.0 (no matter what browser or device) as you can see when you change p5.js version number in the sketch.

Seems like new version is not always better. Any idea when this bug will be fixed?

codevogel commented 6 months ago

I seem to have run into a similar issue.

This sketch seems to run much faster on version <= 1.5.0 https://codepen.io/kemmel-dev/pen/LYvzXqp?editors=1111

asukaminato0721 commented 5 months ago

First step is to find out which commit causes the performance to down.

some records

git diff v1.5.0..v1.6.0 --stat
 src/webgl/3d_primitives.js                              |  228 ++++++++++---
 src/webgl/material.js                                   |   21 +-
 src/webgl/p5.Camera.js                                  |   49 +--
 src/webgl/p5.Geometry.js                                |  252 ++++++++++++--
 src/webgl/p5.RenderBuffer.js                            |    7 +
 src/webgl/p5.RendererGL.Immediate.js                    |   41 ++-
 src/webgl/p5.RendererGL.Retained.js                     |    8 +
 src/webgl/p5.RendererGL.js                              |  143 ++++++--
 src/webgl/p5.Shader.js                                  |   18 +-
 src/webgl/p5.Texture.js                                 |   16 +-
 src/webgl/shaders/basic.frag                            |    6 +-
 src/webgl/shaders/font.frag                             |    6 +-
 src/webgl/shaders/font.vert                             |   16 +-
 src/webgl/shaders/light.vert                            |    7 +
 src/webgl/shaders/light_texture.frag                    |   10 +-
 src/webgl/shaders/line.frag                             |   47 ++-
 src/webgl/shaders/line.vert                             |  140 +++++++-
 src/webgl/shaders/normal.vert                           |    6 +
 src/webgl/shaders/phong.frag                            |   10 +-
 src/webgl/shaders/phong.vert                            |    7 +
 src/webgl/shaders/point.frag                            |   30 +-
 src/webgl/shaders/vertexColor.frag                      |    4 +-
 src/webgl/text.js                                       |   24 +-

so

git diff v1.5.0..v1.6.0 -- src/webgl/*

could print the diff

davepagurek commented 5 months ago

This is a tough one for me because on my computers, I don't notice the same slowdown other commenters are seeing (see also https://github.com/processing/p5.js/issues/6438, this is possibly a duplicate of the same issue?) Might need some community help bisecting to find the commit.

davepagurek commented 5 months ago

I seem to have run into a similar issue.

This sketch seems to run much faster on version <= 1.5.0 https://codepen.io/kemmel-dev/pen/LYvzXqp?editors=1111

I think this is a separate issue: this one is due to stroke quality being higher in new versions of p5. Turning off strokes makes this sketch run fast again, and this was a known tradeoff we made. A suggestion for p5 2.0 was made to add a low fidelity line rendering option in https://github.com/processing/p5.js/issues/6678#issuecomment-2076172350 if you're interested!

OP's sketch was having issues even without lines.