Is anyone else seeing a huge slowdown in set() with 2.1 on OSX 10.8.5?

edited November 2013 in Using Processing

I'm seeing much slower speeds after switching to Processing 2.1. The sketch below runs at 1500-2000 fps on 2.0.3 and only about 400 fps on 2.1. I'm using a Mac Mini running OS X 10.8.5. I don't see the same slowdown on an Ubuntu 13.10 system.

void setup() {
  size(640,480);
  frameRate(3000);  // go as fast as possible
}

void draw() {
  color theColor = color(random(255), random(255), random(255));
  set (int(random(width)), int(random(height)), theColor);
  println(frameRate);
}

Answers

  • edited October 2013

    O

  • edited October 2013

    Benchmark tweaked version: >:)

    // forum.processing.org/two/discussion/833/
    // is-anyone-else-seeing-a-huge-slowdown-with-2-1-on-osx-10-8-5
    
    final int FPS = 010000, UPDATE = 0200 - 1, DELAY = 1000/10;
    
    int res;
    
    void setup() { 
      size(640, 480); 
      frameRate(FPS);
    
      res = width*height;
    
      loadPixels();
    
      thread("displayFPS");
    }
    
    void draw() { 
      //set((int) random(width), (int) random(height), (color) random(#000000));
    
      pixels[(int) random(res)] = (color) random(#000000);
      if((frameCount & UPDATE) == 0)      updatePixels();
    }
    
    void displayFPS() {
      while (true) {
        print(round(frameRate) + "\t");
        frame.setTitle("FPS: " + round(frameRate));
        delay(DELAY);
      }
    }
    
  • Thanks for the timing thread code. That'll come in handy.

    If anything, your program highlights the problem with 2.1 even more. Here's what I'm seeing:

    2.0.3 set() 2500-3000 fps -- pixels[] 2500-3000 fps

    2.1 set() ~400 fps -- pixels[] >10,000 fps

    Again, I don't see that kind of discrepancy on Linux, so I'm seeing a radical slowdown in set() on Mac OS. Anyone else?

  • So weird...

  • IIRC, there was a recent thread about a similar problem. It seems that 2.0 sets smooth() by default, so perhaps set() is affected, if using anti-aliasing. Try to add a noSmooth() in the sketch, to see if it makes any difference.

    PS.: Don't listen to the forum, don't reject answers that you find useful...

Sign In or Register to comment.