[Solved] Can we force frameRate / speed of the program to run fast ?

edited March 2014 in How To...

Hi, In my other post I have asked about the program performance and its dependencies. I wrote a screen test program (displaying a lot of points on the program) for testing the frameRate change depending on the number of points displayed on the screen. I have noticed that when I used P3D/P2D/OPENGL render in size then frameRate increases significantly.

My Question are:

  • Does only rendering cause slow frameRate ? At what extent we can increase the frameRate ? Is there any other method for increasing performance?
  • I know that calculations also causes slow frameRate so in this case how to increase the performance of the program?
  • Is there any method to force the program to increase the frameRate / speed of the program ? How can we use dedicated graphics memory to make our program run fast?
  • Is it work if I write frameRate(10000); in the program to make it run fast ?
Tagged:

Answers

  • Answer ✓

    Function frameRate() only stipulates how much to w8 between draw() calls.
    If draw() finishes within the FPS set, Processing delays next call to it. Otherwise, draw() is called immediately! 3:-O

  • Answer ✓
    • You answer the question in your next one... Faster rendering can be attained by simplifying display (not drawing stuff not on screen, that is cut out, for example) and by using cleverly OpenGL (graphics accelerator, after all).
    • Simplify your computations, make them cleverer, use some tricks (caching, for example), perhaps.
    • Set the frame rate with the frameRate() function. Only indicative of a max speed, though... You can also use a faster computer...
    • You will never have a frame rate this high, and it would be useless anyway. But it would remove any artificial limit (max speed), I suppose.
  • Okay, I have used Datastructure in my code but still my code runs at 10-14 frame/sec. I have used P3D render. Actually the code is written for Kinect using SimpleOpenNI which uses more than 4 java collections (ArrayLists, HashMaps, list , Maps) still it is very slow.

    Is there anyway to force my program to use my dedicated graphics memory like CUDA does?

    Is there any special or advance rendering method which can accelerate my program ?

  • The question is very generic, that's why I give only generic answers... As you found out yourself, slow down can come from code or from display (or both!). If you do lot of heavy computations, it can slow down a sketch. I guess OpenNI do lot of stuff behind the scene, its algorithms are probably non-trivial!

    That said, if you think the slowdown can come from your own code, you can inspect it with a tool like VisualVM, but to find out where slow operations come from can need some advanced Java knowledge (or at least some study).

  • Thanks PhilLho , I don't know what is VisualVM but I'll definitely look into it but I have two more questions

    • 1 - Can we make our program run faster if we increase the processing IDE memory limit ?
    • 2 - Is there any library to use CUDA for processing or anything similar ?
  • edited November 2013
    1. No. It just avoid out of memory errors... Unless you start using more memory because it allows to save computations (cache, PImages, etc.).
    2. No idea. Search for Java, not (only) for Processing, perhaps.
Sign In or Register to comment.