Parsing btBulletFile really slow?

Post Reply
Posts: 24
Joined: Sat Nov 07, 2009 7:57 pm

Parsing btBulletFile really slow?

Post by Empire-Phoenix » Thu Sep 19, 2013 9:27 pm


well I planned to use the serialisation of the bvh and trimesh shapes to speedup my applications start time.
However currently while testing, I found the btBulletFile:parse(false) function to be unbelieavably slow, and assume I did something wrong.

This goes so far, that regenerating the 1million polygon shape and bvh is faster than loading it. Can this be right?

I save the shape with

Code: Select all

 btDefaultSerializer*    serializer = new btDefaultSerializer();
this needs around 960 milliseconds and is fine so far.

However loading needs (actually only parsing the file the rest is nearly not measurable) 2584 milliseconds
The relevant code is:

Code: Select all

bParse::btBulletFile* bulletFile2 = new bParse::btBulletFile((char*)buffer,len); //file is actually loaded from ram
	bool ok = (bulletFile2->getFlags()& bParse::FD_OK)!=0;
	if (ok){
		bulletFile2->parse(false); //this here needs that long 
		... rebuilding with the data from it
Completly regenerating the shape needs less than 3000 milliseconds, so the time save is somewhat small.

I run on linux(ubuntu 13.04) x64
gcc/g++ 4.7.3

I assume I do something wrong? If not can anyone give sugestions to reduce the time for loading?

User avatar
Erwin Coumans
Site Admin
Posts: 4073
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Parsing btBulletFile really slow?

Post by Erwin Coumans » Thu Sep 26, 2013 7:11 pm

I am surprised that loading a .bullet file takes much time, there is not much going on under the hood, aside from pointer patching.
3 seconds for pointer patching seems wrong.

Can you reproduce this in the Bullet/SerializeDemo, loading your .bullet file?

Are you measuring an optimized build (-O2, "Release")?

Posts: 24
Joined: Sat Nov 07, 2009 7:57 pm

Re: Parsing btBulletFile really slow?

Post by Empire-Phoenix » Sat Oct 05, 2013 3:33 am

Hi, sorry for the late reply,

I use optimized build, yes.
I now use a different loading circumventing this problem, by using the bvh de/serializeinPlace with this for essentially the same data and nothing else changed the loading time is only a few ms.
The bvh itself is in the file 300mb in size.

Using my own file read write stuff semms to solved this, but the question remains, what in the parseFile could be so slow?
As far as I understood, it basically contains the same data I use now, only with some kind of chunked stuff. I don't get why it loads so much faster.

The demos are a bit problematic to get to work, as bullet is integrated into another library by build time.

Post Reply