you might get more accurate results if you check the ofGetElapsedTimeMillis() not within one frame, but over say 100 frames - of course then the time will include other operations as well (drawing etc.), but if you just want to compare different ways of doing things it should work…
void update() {
static float begin = 0; // declare this as static, or class variable so preserves value across frames
if(ofGetFrameNum() % 100 == 0) {
float total = ofGetElapsedTimeMillis() - begin;
printf("it took %f ms. to do 100 frames\n", total);
begin = ofGetElapsedTimeMillis();
}
//do stuff here
}
ofGetTimeElapsedMillis isn’t accurate enough to do useful profiling.
are you on Windows, or OSX? if OSX i can send you my FTime and FProfiler classes, which let you do things like go PROFILE_THIS_FUNCTION() at the top of the function, or
PROFILE_SECTION_START(“section name”)
… code …
PROFILE_SECTION_END();
and have the results spat out to the console as a nice nested table…