b2dJson performance?

General discussion about the R.U.B.E editor
Post Reply
yulan6248
Posts: 12
Joined: Wed Jul 10, 2013 9:10 am

b2dJson performance?

Post by yulan6248 »

I've just taken a look at the b2dJson, and it seems to me that looking up anything by name would be rather slow (involving walking through the whole map).

In my own application should I implement my own additional data-structure if I'm going to reference bodies by name extensively?


Btw: in RUBE there can be multiple images attached to one body, but b2djson doesn't provide a function to find all these images at once (you have to loop through all images to check for youself)
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: b2dJson performance?

Post by iforce2d »

Typically you only need to look things up by name once when loading. After that, you will have found them and put them in your own data structure anyway. The b2dJson class is intended to be used as a temporary instance only, so you would not be using it extensively while the game is running. Of course, you can do that, but like you say it's not efficient.
Post Reply