processing / processing/p5.js

copy function slow performance since v0.10.0

Open
#5,237 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Core Bug
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • [x ] Core/Environment/Rendering
Details about the bug:
  • p5.js version: since v0.10.0
  • Web browser and version: Edge v90
  • Operating System: Windows 10
  • Steps to reproduce this:

The framerate drops significantly (3fps), when using the copy() function in the context shown in the examples below. I tried to recreate the tutorial of Tim Rodenbröcker about kinetic typography in p5.js.
This happens when p5 versions since 0.10.0 are used. It runs smoothly with versions before 0.9.0.

v0.9.0: https://editor.p5js.org/eriksiemund/sketches/ZD7V3_qKM
v.1.3.1: https://editor.p5js.org/eriksiemund/sketches/79w6n7V2W

The issue is already posted in the p5 forum, where micuat suggested a solution. He replaced copy() with context.drawImage and made a guess, that it might have something to do with the implementation of loadPixels since v0.10.0.

Fix by misuat: https://editor.p5js.org/micuat/sketches/XXyKscqN9

Link to forum thread: https://discourse.processing.org/t/p5-js-copy-function-slow-performance-since-version-0-10-0/30007

Thank you in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked p5.js sketches and forum thread to reproduce the framerate drop across the cited versions. Then inspect the copy() and loadPixels() implementation, comparing it with the context.drawImage workaround. Done means the reproduction no longer shows the reported performance regression while preserving copy() behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.