• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Which is more efficient ?

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
Straight to the point, which is more efficient ?

TRIGGER 1:
  • Actions
    • Set Integer = (Level of Acid Bomb for (Triggering unit))
    • Set Damage = (Damage x (Real(AbilityLevel)))
TRIGGER 2:
  • Actions
    • Set Real = (Real((Level of Acid Bomb for (Triggering unit))))
    • Set Damage = (Damage x Real)
Since both trigger consisting of "conversion", which is more efficient or both of them performs at a same degree ?

Basically:
TRIGGER 1 = I2R
TRIGGER 2 = R2I
Damage = Real
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
you really should focus on other things to improve performance like choosing the right special effects, using indexing over hashtables and SetUnitX/Y over "Move Unit instantly", maybe a filter function for unit group enumerations (well....at this point you could move to JASS anyway)

slow car is slow, no matter which color you paint it
 
Level 4
Joined
Jul 24, 2010
Messages
85
All I know is conversion will surely cause trigger to run slower. (But very little)
Integer Variable In c++ will reduce using of memory.

Anyway Warcraft III store all variable in the same size of memory. (Real and integer are using the same size of memory)
From my knowledge, in Warcraft III, they are the same.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
you really should focus on other things to improve performance like choosing the right special effects, using indexing over hashtables and SetUnitX/Y over "Move Unit instantly", maybe a filter function for unit group enumerations (well....at this point you could move to JASS anyway)

slow car is slow, no matter which color you paint it

Are you on the right thread ?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If you like Porsche, why buy a Ferrari ?
It's the same thing, and it's personal opinion to choose JASS over GUI
I, myself, acknowledged that JASS > GUI, but you don't have to force GUIer to change over to JASS
What I'm asking now is current situation (don't go outside the box... like DSG sometimes saying about Starcraft II but we're actually on Warcraft III forum area)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
In WC3...
A real is a single precision float.
An integer is a 32bit siged integer type.

Due to the differences in how the data is stored and manipulated...
Float opperations are often slower than equivelent integer opperations.
Changing between the 2 types takes time.
Converting to integer loses range while converting to float looses precision.
Instructions may exist to allow integer interaction with floats directily (no need to convert).

In JASS (WC3)
All integers will automatically convert to reals when required (implied conversion)
All reals must be converted to integer through a native call (which if it executes a separate function will be stupdily slow).
GUI uses special Integer to Real converter function which is nothing but bloat (slower).

Do be aware that conversions are need to be done for every field that takes a real if passed an integer which may mean storing a value as a real yields a speed up for that situation.
 
Status
Not open for further replies.
Top