Measuring of rendering performance for Remote python-based Visualisation

Dear David Gobbi,

Thank you very much.

The units of “frames per second” is not “seconds”, so this is incorrect:

fps=renderer.GetLastRenderTimeInSeconds()

Oh, yes, sorry for confusion, I have a wrong naming of variables here. Actually I was printing out seconds (as the pdf I have referenced also makes measurements in seconds) and collecting average FPS below as 1.0/renderer.GetLastRenderTimeInSeconds(). Correcting with renderWindow->Render() has slightly changed the results, although in total the situation is the same:

Python

seconds per frame 0.04394817352294922
seconds per frame 0.00014400482177734375
seconds per frame 0.0001430511474609375
seconds per frame 0.0003490447998046875
seconds per frame 0.0001652240753173828
seconds per frame 0.0001850128173828125

Total FPS: 3406.4299667781806
AVERAGE FRAME RATE: 60.03015602558754

C++

Cells number 4674431
seconds 2.28882e-05
seconds 9.05991e-06
seconds 6.91414e-06
seconds 6.91414e-06

seconds 6.91414e-06
seconds 7.15256e-06
seconds 0.0002141
seconds 1.00136e-05
seconds 6.91414e-05

Total FPS: 139565
AVERAGE FRAME RATE: 93902.3 fps

Please, note that I am measuring FPS by two different approaches that average the obtained values.
First approach

 for (int i=0;i<endCount;i++)
  {
 
 double max[3]={bounds[1]+vtkMath::Random(0,10),bounds[3]+vtkMath::Random(0,10),bounds[5]+vtkMath::Random(0,10)};
  double min[3]={bounds[0]+vtkMath::Random(0,10),bounds[2]+vtkMath::Random(0,10),bounds[4]+vtkMath::Random(0,10)};
 

    
    renderer->ResetCamera(min[0],max[0],min[1],max[1],min[2],max[2]);
    renderWindow->Render();
    double sec=renderer->GetLastRenderTimeInSeconds();
  time+=double(1.0)/(sec);
  std::cout<<"seconds "<< sec<<std::endl;
  
  }
  std::cout<< "Total FPS: " << time/double(endCount) << std::endl;

Gives in C++:
Total FPS: 139565

Second approach:

 vtkSmartPointer<vtkTimerLog> clock =
    vtkSmartPointer<vtkTimerLog>::New();

  clock->StartTimer();
  for (int i = 0; i < endCount; i++)
    {
double max[3]={bounds[1]+vtkMath::Random(0,10),bounds[3]+vtkMath::Random(0,10),bounds[5]+vtkMath::Random(0,10)};
  double min[3]={bounds[0]+vtkMath::Random(0,10),bounds[2]+vtkMath::Random(0,10),bounds[4]+vtkMath::Random(0,10)};
 

    
    renderer->ResetCamera(min[0],max[0],min[1],max[1],min[2],max[2]);
    renderWindow->Render();
    }
  clock->StopTimer();
 double frameRate = (double)endCount / clock->GetElapsedTime();
  std::cout << "AVERAGE FRAME RATE: " << frameRate << " fps" << std::endl;

That gives:
AVERAGE FRAME RATE: 93902.3 fps

The updated codes are attached
main.cpp (4.4 KB) test.py (2.7 KB)

Thank you very much in advance,
Best regards,
Evgeniya