HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Alternative ExecFunc?

04-25-2007, 02:46 AM#1
MaD[Lion]
WOndering if there is another way to evaluate a function by it's name as string than using slow ExecFunc.
Would be nice to know.
04-25-2007, 03:00 AM#2
grim001
Just answered this in your other thread..
04-25-2007, 03:53 AM#3
PipeDream
TriggerEvaluate is the fastest way this community knows of. TriggerExecute is OK too, and behaves the same as ExecuteFunc w.r.t. threading issues. You could do some weird impractical things like put the function on a trigger and then get the trigger to run through roundabout means. Timer is another option, one which might not suck. If you don't care precisely when things execute it may turn out you can get a high throughput from timer expirations.
04-25-2007, 04:00 AM#4
grim001
Yeah, vJASS function interfaces use a function call and then a triggerevaluate I think.
04-25-2007, 04:25 AM#5
Vexorian
Eventually it would get inlined if possible,

It is awesome but even .execute() which uses TriggerExecute + function call turned out to be faster than executefunc.

Quote:
WOndering if there is another way to evaluate a function by it's name as string than using slow ExecFunc.
Would be nice to know.
There is no faster way to call a function by its "name as a string" . But you don't really need that, do you?
04-25-2007, 07:59 AM#6
MaD[Lion]
I do that is the problem. Their name are stored as "string". So i cant do it another way?
04-25-2007, 08:02 AM#7
PipeDream
There are a bajillion ways to map strings (aka integers) to triggers (aka integers). Take your pick, the best is to just write down your integer ahead of time with a constant which will get inlined. Even gamecache is probably faster.
04-25-2007, 10:19 AM#8
MaD[Lion]
sorry piepedream but ive alctually not been able to understand your posts until now. Ur choice of words is a bit complicated to me. And im not english either :P
As long as i understand u atm, is that you want me to do some kind of trigger to integer, then store that integer... and then do a integer to trigger and evaluate it... is that what you mean? Or am i wrong.
Besides is evaluate trigger faster than execfunc? Cus this can be an alternative.

And grim001: Yoou talked about function interface, but how would i link a function to eac individual object (struct)?
Cus with my poor knowledge i think you need to extends an interface when u declare a struct... Not when u create an object froms struct
04-25-2007, 11:29 AM#9
blu_da_noob
Quote:
Originally Posted by MaD[Lion]
As long as i understand u atm, is that you want me to do some kind of trigger to integer, then store that integer... and then do a integer to trigger and evaluate it... is that what you mean? Or am i wrong.
Besides is evaluate trigger faster than execfunc? Cus this can be an alternative.

TriggerEvaluate is faster than ExecuteFunc. One method of doing this could be to have a global trigger array which you can store triggers in and you just pass the index of the trigger you want to it to call at X point. As an example.
04-25-2007, 11:47 AM#10
MaD[Lion]
Hmm sounds like an idea. seems like thats the only way

edit: Interesting, was reading about function interface. That is also a possibility.
Vex... is it faster to run function from function pointer than to use ExecuteFunc ?
Also using function interface.
Cus if it is, i guess that will be the method i will use. Since its OO'ed
04-25-2007, 01:24 PM#11
Vexorian
I already said that even .execute is faster than ExecuteFunc , .evaluate() takes like 1/3 of ExecuteFunc , and soon there will be inlining for interfaces and function interfaces , without that extra function call it will get terrorifying faster than ExecuteFunc.

Quote:
There are a bajillion ways to map strings (aka integers) to triggers (aka integers). Take your pick, the best is to just write down your integer ahead of time with a constant which will get inlined. Even gamecache is probably faster.
I tried an "ExecuteFunc killer" like this before, and it sucked, a lot.
04-25-2007, 01:38 PM#12
MaD[Lion]
so .execute and .evaluate are same just .execute do it in new thread?
Or is .evaluate faster than .execute
04-25-2007, 01:55 PM#13
Vexorian
The answer to both questions is yes
04-25-2007, 03:08 PM#14
MaD[Lion]
then evaluate is better to use. Thx vex :P Problems solved, this thread can be deleted
04-25-2007, 03:39 PM#15
Earth-Fury
Quote:
Originally Posted by MaD[Lion]
then evaluate is better to use. Thx vex :P Problems solved, this thread can be deleted
deletion of threads where problems are solved is bad. why? because then whats the point of using the search feature?