Very slow visual studio compilation

Hi there,

I'm writing a math library that follows the GLSL syntax closely.

I want to allow for doing the following (which is valid in GLSL):
1
2
3
4
vec3 a = vec3( 0.1, 0.2, 0.3 );
vec3 b = vec3( 1, 2, 3 );
a.yzx = b;
//a is vec3( 3, 1, 2 ) 


In order to do this, I've implemented it the following way:
https://github.com/Yours3lf/libmymath/blob/master/mymath/mm_vec3_impl.h#L22

which works perfectly, but I'm also writing a SSE optimized version, and this is where my problem is.

For the SSE version I needed to shuffle the input vectors' components (b in the example) a certain way, so that its components modify the original vector's components (a in the example) properly.
I implemented it using some helper macros that are evaluated in compile time:
https://github.com/Yours3lf/libmymath/blob/master/mymath/mm_fvec3_impl.h#L27
(macro on line 21)

However this macro solution turned out to take really long time to compile on both Visual Studio 2013 and 2015RC as well.

I tried to use constexpr too, but VS does not support it properly yet.

Do you have any idea on how I could implement the SSE version in a way that it does not make the compilation slow?
Last edited on
now I tested it on linux/gcc 4.8.2 and it still takes a lot of time, but not that much...
so I've managed to make the macro handling really small, but the compilation time is still very-very slow...
see:
https://github.com/Yours3lf/libmymath/blob/master/mymath/mm_common.h#L43

any idea why this could be?
Have you tried precompiled headers?
How have you confirmed that MM_SHUFFLE_SWIZZLE_HELPER is the culprit?
(I'm not so sure it is.)
@poteto yes, they didn't help at all

@Duoas I think so, because without it the compilation times are fine. It is possible though that the combination of all the tricks involved in making swizzling work makes the compilers go mad.
Tried it on GCC too, it performed better, but it was still slow.
Topic archived. No new replies allowed.