Most appropriate sub-area of p5.js?
p5.js version
2.3.0
Web browser and version
- Chrome Version 151.0.7922.34 (Official Build) (arm64)
- Safari Version 26.5.2 (21624.2.5.11.8)
- Firefox 152.0.4 (aarch64)
Operating system
macOS 26.5.2 (25F84) Tahoe
Steps to reproduce this
Description
Calling set() on a p5.Graphics buffer is considerably slower in p5.js 2.3.0 than in 1.11.12. Note: directly modifying pixels[] performs about the same in both versions.
I first noticed the issue when trying to run the following sketch in p5.js 2.3.0: https://openprocessing.org/@megamitts/2979162
Benchmark
I made a quickly vibe coded benchmark sketch to systematically test the issue. It updates a 100 × 100 p5.Graphics buffer over multiple frames and prints the averaged results to the console.
In this test in Chrome, set() was about 6.9 times slower in 2.3.0 than in 1.11.12.
| p5.js version |
set() |
pixels[] |
set() slowdown vs pixels[] |
| 1.11.12 |
1.85 ms |
1.10 ms |
1.7× |
| 2.3.0 |
12.79 ms |
1.16 ms |
11× |
I got comparable results, with slowdowns between ~9× and ~17×, in Safari and Firefox.
Reproduction
Run the benchmark sketch in p5.js 1.11.x, then in 2.x
Most appropriate sub-area of p5.js?
p5.js version
2.3.0
Web browser and version
Operating system
macOS 26.5.2 (25F84) Tahoe
Steps to reproduce this
Description
Calling
set()on ap5.Graphicsbuffer is considerably slower in p5.js 2.3.0 than in 1.11.12. Note: directly modifyingpixels[]performs about the same in both versions.I first noticed the issue when trying to run the following sketch in p5.js 2.3.0: https://openprocessing.org/@megamitts/2979162
Benchmark
I made a quickly vibe coded benchmark sketch to systematically test the issue. It updates a 100 × 100
p5.Graphicsbuffer over multiple frames and prints the averaged results to the console.In this test in Chrome,
set()was about 6.9 times slower in 2.3.0 than in 1.11.12.set()pixels[]set()slowdown vspixels[]I got comparable results, with slowdowns between ~9× and ~17×, in Safari and Firefox.
Reproduction
Run the benchmark sketch in p5.js 1.11.x, then in 2.x