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.74k stars 3.34k forks source link

texture() slow when no id #2926

Closed micuat closed 5 years ago

micuat commented 6 years ago

I found that texture(...) is slow when the img/canvas tag to be bound does not have an id (example code at the bottom)

Nature of issue?

Most appropriate sub-area of p5.js?

Which platform were you using when you encountered this?

Details about the bug:

Compare the framerate with / without line 12: https://alpha.editor.p5js.org/micuat/sketches/ry-6oxxkQ

micuat commented 6 years ago

And the issue becomes significant with larger texture size

micuat commented 6 years ago

I noticed that it has nothing to do with id; but the width/height parameter slows down the texture function: https://github.com/processing/p5.js/blob/5f6b4ab7e1c1a680186e52a9a1ac3f63450e8406/src/core/p5.Element.js#L148

stalgiag commented 5 years ago

Closing as I wasn't able to detect framerate changes in 0.7.2 with the included example. If you can still repro then feel free to post something here and I will repoen