Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Oct 11, 2017 5:15 am 
Offline

Joined: Wed Oct 11, 2017 4:45 am
Posts: 6
I see description of btAlignedObjectArray class
Quote:
.\bullet3\src\LinearMath\btAlignedObjectArray.h

The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods
It is developed to replace stl::vector to avoid portability issues, including STL alignment issues to add SIMD/SSE data


I see that stl and std are difference.

But I confuse why Bullet don't use std::vector (std::vector is really optimized) instead of creating btAlignedObjectArray class, maybe there is a reason so I don't know if I should use std::vector instead of btAlignedObjectArray?

Thanks for reading :D


Top
 Profile  
 
PostPosted: Wed Oct 11, 2017 1:43 pm 
Offline
User avatar

Joined: Tue Sep 30, 2014 6:03 pm
Posts: 346
Location: San Francisco
The reason Bullet uses btAlignedObjectArray is right there in that comment you found: to avoid portability issues and to support SIMD/SSE data. SIMD data blocks (128 bits) must be 16-byte aligned, otherwise the optimized instructions won't work.

If you want to make an array of btVector3, btTransform, or other Bullet classes that take advantage of SIMD optimizations, you would want to use btAlignedObjectArray. For other data (your own classes that don't derive from Bullet classes) you can safely use std::vector.


Top
 Profile  
 
PostPosted: Thu Oct 12, 2017 1:26 pm 
Offline

Joined: Wed Oct 11, 2017 4:45 am
Posts: 6
drleviathan wrote:
The reason Bullet uses btAlignedObjectArray is right there in that comment you found: to avoid portability issues and to support SIMD/SSE data. SIMD data blocks (128 bits) must be 16-byte aligned, otherwise the optimized instructions won't work.

If you want to make an array of btVector3, btTransform, or other Bullet classes that take advantage of SIMD optimizations, you would want to use btAlignedObjectArray. For other data (your own classes that don't derive from Bullet classes) you can safely use std::vector.

Thank drleviathan :) So as I understand, btAlignedObjectArray is mean for Bullet internal use (optimize Bullet purpose). The client code can use std::vector instead of btAlignedObjectArray.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group