testing code instability

edited October 2017 in Questions about Code

Hello, I am puzzled about an instability that i reproduced with the following test code :

//scoping test
void setup(){
surface.setVisible(false);
}
void draw(){
noLoop();
scoping();
}
void scoping(){
int w =300; int h = 300;
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
int loc = x + y*w;
println(x+" "+y+" "+loc);
}
}
}

For values of w*h larger than #100000 (and sometime less), the code stops with no error display. I need to kill the task for restart. Any idea ? Thank you for helping

Tagged:

Answers

  • Answer ✓

    Remember: draw() tries to run 60 times a second. Do you really need to do 6 million println()s a second, for the same data over and over again?

  • I realize it was a real beginner question. Thanks so lot. Denis

  • Answer ✓

    Especially println is not reliable, for many many lines better use text()

  • Thanks, I will try your suggestion on the next bench.

Sign In or Register to comment.