EDIT: there’s no difference in draw thread performance indeed between Python and C++ Panda versions. I’ve ran my tests incorrectly.
I decided to test this out myself. I have a GTX 1060 with 6 GB VRAM, an Intel i7-8750h, and 16 GB of system RAM.
In Python and C++, I loaded a scene of 5000 smileys using the same PRC configuration. Frame time was pretty much identical between Python and C++, around 13 ms. The only difference was that an extra .1 ms was spent running the ShowBase tasks in Python.
C++
#include "load_prc_file.h"
#include "pandaFramework.h"
#include "windowFramework.h"
#include "loader.h"
#include "nodePath.h"
#include "pStatClient.h"
int main( int argc, char **argv )
{
load_prc_file_data( "", "framebuffer-multisample 0" );
load_prc_file_data( "", "multisamples 0" );
load_prc_file_data( "", "framebuffer-alpha 0" );
load_prc_file_data( "", "framebuffer-srgb 0" );
load_prc_file_data( "", "support-stencil 0" );
load_prc_file_data( "", "color-bits 8 8 8" );
load_prc_file_data( "", "alpha-bits 0" );
load_prc_file_data( "", "depth-bits 8" );
load_prc_file_data( "", "sync-video 0" );
PandaFramework framework;
framework.open_framework( argc, argv );
WindowFramework *win = framework.open_window();
win->setup_trackball();
PStatClient::connect();
Loader *loader = Loader::get_global_ptr();
for ( int i = 0; i < 5000; i++ )
{
NodePath sm( loader->load_sync( "models/smiley.egg.pz" ) );
sm.node()->set_final( true );
sm.reparent_to( win->get_render() );
}
win->get_render().ls();
while ( true )
{
framework.do_frame( Thread::get_current_thread() );
}
return 0;
}
Python
from panda3d.core import loadPrcFileData
loadPrcFileData("", "framebuffer-multisample 0")
loadPrcFileData("", "multisamples 0")
loadPrcFileData("", "framebuffer-alpha 0")
loadPrcFileData("", "framebuffer-srgb 0")
loadPrcFileData("", "support-stencil 0")
loadPrcFileData("", "color-bits 8 8 8")
loadPrcFileData("", "alpha-bits 0")
loadPrcFileData("", "depth-bits 8")
loadPrcFileData("", "want-pstats 1")
loadPrcFileData("", "sync-video 0")
from direct.showbase.ShowBase import ShowBase
base = ShowBase()
for i in range(5000):
sm = loader.loadModel("models/smiley.egg.pz")
sm.node().setFinal(True)
sm.reparentTo(render)
render.ls()
base.run()
3 Likes
Thanks for your test. I don’t know how I got those numbers yesterday. I’ve rerun my code samples and got pretty much the same results you’ve had. Sorry for taking your time. Now I must admit that Python DOES NOT slow down your rendering. P.S. I’ll have to edit the original post not to confuse Panda users.
1 Like