x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Blueprint compare enum

Hello, guys!
I have a question regarding Equal(enum) node.
I am a java programmer and I know that 0 == index is faster than index == 0. Does this apply to the blueprint node as well?
alt text

Product Version: UE 4.19
Tags:
untitled2.png (18.1 kB)
more ▼

asked Apr 24 '18 at 01:05 PM in Blueprint Scripting

avatar image

Leo Zhekov
8 1 3 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I think, faster way would be byte compare

alt text

First selected on top (screen shot). Probably with blueprint is not so much difference, if you need optimized game like this, you should code in C++.

Anyway, this is not very important optimization (no loop) and in game much more important parts, you can lost more frames with bad mesh, code, material etc.

I use mostly 3rd solution, switch on Enum.

more ▼

answered Apr 24 '18 at 01:41 PM

avatar image

Vaheva
1.3k 24 30 53

avatar image Leo Zhekov Apr 24 '18 at 02:07 PM

I am not comparing on Tick event. I just wondered if it mattered and if there's any difference. Thank you for your response!

avatar image Vaheva Apr 24 '18 at 02:18 PM

I'm not sure which way is better nor I can't think about it now so much, but to understand how it works maybe this can help you:

alt text

Most of simple looking functions, macros etc in engines are checking loops like this for example. Switch checking every item in array. You can check - here is difference in loop length 0 == index is faster than index == 0 - I'm not sure. This screen is not "exploded" unreal engine macro, just my visualization how I think it works, based on my experience with other macros or engine functions.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question