magneto Posted June 5, 2013 Share Posted June 5, 2013 Hi, I was watching SESI's latest tutorial, and around 20:24 the author says using set() is much faster than using {1,2,3}. He says it automatically casts as a vector instead of converting it which takes clock cycles. Is this true? I always thought both of these would yield a similar code. In fact I think one using the literal (constant) value should be faster. Or is it because the VEX compiler don't do any aggressive optimizations? Here is the video: Thanks Quote Link to comment Share on other sites More sharing options...
crunch Posted June 5, 2013 Share Posted June 5, 2013 The VEX optimizer does some pretty heavy optimization. I'm pretty sure that both cases would optimize to the same execution code. However, the {} syntax doesn't work when you have variables as components, it's only usable for constants, so you might want to use the set() function since it's more general. Of course, having the displacement in a variable could be very handy for other reasons. When I use the performance monitor to profile the two cases, the results are pretty much identical (around 58ms for 1M points). 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted June 6, 2013 Author Share Posted June 6, 2013 Thanks I noticed around 100ms difference for 4M points that's why I was wondering about this. I always use {} because it's faster to type, unless I need to use variables, in which case I have to change it to set() of course. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.