processing / processing/processing4

rounded rectangle performance in P2D / P3D is extremely poor when stroke is used

Open
#1,566 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lower priority
Dominant language
Java
Stars
494
Forks
183
Avg merge
4h 39m
Merged PRs (30d)
3

Description

Image

MacBook Air M3
Processing 4.5.6 (but also older versions apply)

This runs at around 8.5 fps.

void setup() {
  size(800, 800, P2D);
  frameRate(999);
}

void draw() {
  background(0);

  int cols = 16;
  int rows = 16;
  float margin = 50;
  float gap = 10;

  float rectW = (width - margin * 2 - gap * (cols - 1)) / cols;
  float rectH = (height - margin * 2 - gap * (rows - 1)) / rows;

  fill(255, 220, 0);
  stroke(255);
  strokeWeight(2);
  
  for (int y = 0; y < rows; y++) {
    for (int x = 0; x < cols; x++) {
      float px = margin + x * (rectW + gap);
      float py = margin + y * (rectH + gap);

      rect(px, py, rectW, rectH, 10);
    }
  }

  println(frameRate);
}

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 by running the supplied Java sketch in Processing 4.5.6 and compare the frame rate with stroke enabled versus disabled, in both P2D and P3D. Trace the rounded-rectangle rendering path used by these modes; done means the reproduction no longer shows the reported severe slowdown while preserving stroked rounded rectangles.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-graphics, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.