Bug 736 : extremely highly values for frameRate produce odd results
Last modified: 2008-02-23 01:03




Status:
RESOLVED
Resolution:
WONTFIX -
Priority:
P2
Severity:
normal

 

Reporter:
johnclavin
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-02-22 19:08
The following code is slow.

void setup() {
size(800, 500);
background(255);
stroke(0);
frameRate(10000);
}

void draw() {
float x = random(width);
float y = random(height);
point( x, y );
}

This code is very fast.

void setup() {
size(800, 500);
background(255);
stroke(0);
frameRate(10000);
}

void draw() {
for(int x = 0; x < width; x++) {
point( x, random(height) );
}
}

I entered this into java runtime parameters, but it made no difference.

-XX:+ForceTimeHighResolution

I notice that the slow code runs faster if 2 sketch windows are open and the second
window is running the fast code.
I am using Java 1.4.2_16 but I notice that on a machine with Java 1.6.0_04 (the
latest) the slow code runs as fast as the fast code.
For trouble shooting I wrote this small program to see if it could be a random
problem, but I think that it is just a frameRate issue.

void setup() {
size(800, 500);
background(255);
frameRate(10000);
}

color redJC = color(255, 0, 0);
color greenJC = color(0, 255, 0);
color whiteJC = color(255, 255, 255);
color colorTest;

void draw() {
int x = randomAct(width);
int y = randomAct(height);
colorTest = get(x, y);
if(colorTest != whiteJC) {
stroke(redJC);
point( x, y );
}
else {
stroke(greenJC);
point(x, y);
}
}

int randomAct(int input) {
return int(random(input));
}

I am finally, just getting into Processing. eHaa!

Thanks for developing it,

John Clavin

Win XP (core 2 duo laptop)
Java 1.4.2_16
Processing -0135
Additional Comment #1 From fry 2008-02-22 19:12
it's impossible to blit the screen that quickly, so that's not something
we're gonna follow up on.

but regardless, frameRate is based on a millisecond timer, which is where
we're stuck as long as Java 1.4 is our target platform.
Additional Comment #2 From johnclavin 2008-02-23 00:34
Sorry, I left the high frame rate in there, I was playing around with different rates.

I removed the frameRate line from both programs and rebooted my computer, and
the results are the same. The slow program is still considerably slower than the fast
program. But when two sketch windows are open with both programs the slow
program runs faster.
The third program that tests for correct random operation also runs very slow with the
frameRate line removed.
If you can't recreate the problem then maybe I have got something messed up.

John Clavin
Additional Comment #3 From johnclavin 2008-02-23 01:03
Ok, I see my error. Operator error! Sorry, I am an idiot.

My fast program makes 800 passes in each draw() frame.

I guess I was originally thrown off by seeing the slow program run so fast on a Java
1.6 machine with the frameRate jacked up. I hear what you said about the timer
limitations of Java 1.4

Sorry to bother you guys,

John Clavin