HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

.execute vs ExecuteFunc [vJass]

05-20-2008, 07:43 PM#1
Troll-Brain
i know what .execute do exactly but is it faster than ExcuteFunc ?
i think not because it call a function which call an execute of a trigger.

So it should have a feature in vJass that i don't know ?
05-20-2008, 08:27 PM#2
Captain Griffen
ExecuteFunc is very slow. .execute is faster, and .evaluate faster still (but evaluate does not allow you to use waits).
05-20-2008, 08:31 PM#3
Troll-Brain
Quote:
Originally Posted by Captain Griffen
ExecuteFunc is very slow. .execute is faster, and .evaluate faster still (but evaluate does not allow you to use waits).
and you can return a value with .execute
Thx for the answer
05-20-2008, 08:33 PM#4
TheDamien
Quote:
Originally Posted by Captain Griffen
.execute is faster, and .evaluate faster still

Is there a source for this? I recall reading something about .execute being faster, but all the manual says is:

Quote:
Originally Posted by Manual
.execute() is actually faster than good old ExecuteFunc, and in later versions it might actually get even faster. evaluate halves the duration of ExecuteFunc and it may get much better later.

Which seems to say that both are faster than ExecuteFunc, but little more.
05-20-2008, 10:23 PM#5
Toadcop
Quote:
ExecuteFunc is very slow. .execute is faster
the differense is very small... (in truth)
05-20-2008, 10:57 PM#6
Vexorian
ExecuteFunc lamenizes your script, .execute doesn't.

When I end up adding the shortest name optimization to jasshelper, ExecuteFunc will prevent this new jasshelper optimization from being called. Yes, as a matter of fact, I am just about to begin a massacre against scripts that use ExecuteFunc or TriggerRegisterVariableEvent, or whatever that lame real variable stuff is.

Edit: .execute() on a "takes nothing returns nothing" function just got as fast as TriggerExecute since jasshelper 0.9.A.0 . According to pipedream TriggerExecute is 2 times faster than ExecuteFunc, so make up your decision.
05-21-2008, 10:44 AM#7
Toadcop
just tested.

ExecuteFunc("XXX") - ~28x

TriggerExecute(trg_XXX) - ~21x

so yeah it's better. but in fact.
TriggerEvaluate is much better.
05-21-2008, 11:14 AM#8
Vexorian
I would say the result will change if you add 100 functions before TriggerExecute.

These TriggerEvaluate/Execute benchmarks always seem to vary this much.
05-21-2008, 11:21 AM#9
TheDamien
Quote:
Originally Posted by Toadcop
TriggerEvaluate is much better.

Bah, all this time I thought it was the other way around.
05-21-2008, 11:31 AM#10
Vexorian
TriggerEvaluate doesn't create another thread, so it is pointless to compare it with the Execute dudes.

.evaluate() is also optimized recently to use TriggerEvaluate() directly (provided the function takes nothing returns nothing)
05-21-2008, 11:53 PM#11
Toadcop
Quote:
I would say the result will change if you add 100 functions before TriggerExecute.
i test anything in construction like that...

loop
exitwhen i>1000
// do xxx
set i=i+1
endloop

so it have more realistic stress situation imitation xD (sound lol)
05-22-2008, 12:01 AM#12
Vexorian
The number of times you call ExecuteFunc has nothing to do with the number of functions in the script. It might actually be less realistic anyway -> in real life you would actually only call it once in a while, and there are caching stuff hidden in the OS and architecture that change the proportion when calling something 1000 times.
05-22-2008, 12:03 AM#13
TEC_Ghost
Didn't even know this was in VJass...

So instead of

Collapse JASS:
call ExecuteFunc("SetupImages")

it would be

Collapse JASS:
call .execute("SetupImages")

And does .execute create a new thread? (The whole reason I'm using a function execute.)
05-22-2008, 12:05 AM#14
Vexorian
Actually:

Collapse JASS:
call SetupImages.execute()

Quote:
And does .execute create a new thread? (The whole reason I'm using a function execute.)

It typically becomes something like this:
Collapse JASS:
call TriggerExecute(t__somename[7] )
I think in the next version I'll make it so the array stuff is not used.