Jump to content

Is set VEX function faster than using literal values?


Recommended Posts

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 :)

Link to comment
Share on other sites

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).

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...