|Re: [eigen] Patch for quaternion normalization and cross product for Vector4f|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Patch for quaternion normalization and cross product for Vector4f
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 10 Mar 2009 14:24:03 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=iCG0TxUSYtXbl0Ml8MTZGHJEsA6UPyj7nT3lZC+ZSN8=; b=GrC1B8uP1xkk0V5Q7BxLvbHbHOn5zVPqlDs1sTfKlSBE3bwcvp4S7DbzCxgsaSVNIw qdFe5Gxh0P45Fl9xhy4SEPepIt8PJXMFzT5LPQ2ihFgNdLULH1ghekMyGeb3sxWE1tbq LYwBf6w2QywQ+VgJVLmtk8EkpPLbrpg1/h3BY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=cP0aeMcH8YJGmtYWnrNml8qEfxS5QQlXGkb2Kb6mAmwTAlLCCjfyab1qpVHXDpF36m W+lWzA81j7VhNNV33NvKEEERBXJZHcnRrspYN48vEDo8xPqP2/xhiIuTdBK0T0ZR5hP+ 2RHwqHXRScawVKkFrln1KYZWz46ANOoUuOMt0=
On Tue, Mar 10, 2009 at 12:38 PM, Rohit Garg <rpg.314@xxxxxxxxx> wrote:
> Well, that's the classic AoS vs SoA argument. It's just that I have
> seen many people use Vector3f where you lose vectorization. And yes, I
> am doing an app where using vec4f for 3dim vectors would be a definite
> win even without the cross product. So it is not an abstract demand.
> In this case, the perf boost may not be much but added with other
> cases, such as add, sub, dot, in a large app, it will almost always
> turn out to be better.
> SoA may be better from vectorization pov, but AoS is used more often
> simply because it is easier from a conceptual pov. IMHO, it is a small
> thing which makes vec4f much better overall and usable for stuff like
> 3d geometry. So please consider including it. If you look at the
> Bullet physics SDK, they implement vec3 routines using sse only.
yes that's true that AoS is more convenient, and I agree it might be
handy to have an optimized cross3. Honestly, when dealing with such
small vectors, if your code includes many dot/cross products,
normalizations, etc... then I doubt the speed up could be above x1.5.
Significant speedup can only come from a more high level
reorganization of your algorithm, and using complex memory layouts...
Regarding Bullet SDK, actually only some specific parts of the SDK are
vectorized by hand (using directly inline assembly and/or using
directly intrinsics) and there the base classes (matrix, vector) are
not vectorized at all.