| 04-25-2007, 02:46 AM | #1 |
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 |
Just answered this in your other thread.. |
| 04-25-2007, 03:53 AM | #3 |
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 |
Yeah, vJASS function interfaces use a function call and then a triggerevaluate I think. |
| 04-25-2007, 04:25 AM | #5 | |
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:
|
| 04-25-2007, 07:59 AM | #6 |
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 |
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 |
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 | |
Quote:
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 |
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 | |
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:
|
| 04-25-2007, 01:38 PM | #12 |
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 |
The answer to both questions is yes |
| 04-25-2007, 03:08 PM | #14 |
then evaluate is better to use. Thx vex :P Problems solved, this thread can be deleted |
| 04-25-2007, 03:39 PM | #15 | |
Quote:
|
