| 10-02-2007, 01:59 AM | #1 | ||
Hi guys: After one discussion taken in this section about vJASS (I forgot where and when was this, probably everywhere :P), the fact is that it was mentioned the command ResetTrigger(t). After that, it started to buzz in my head the idea, if we can recycle timers, why not recycle triggers too?? Then I did a small modification of CSSafety and using the beautiful vJASS I wrote this code:
I did it in that way because I wanted to do a quick test about how it behaves. I did a test map where I add to each unit created an event damage trigger, that makes explode the unit when it receives the attack. Due that I'm not good at benchmarking, I'd like to know if this test can be done in a better way (I'm sure there is a better way). Please feel free to edit the map in order to improve the benchmark, and of course, any bugs or improvements to this library are welcome. This is the code of the testing test map:
|
| 10-02-2007, 03:02 AM | #2 |
What about those nasty things called TriggerActions? Won't you be leaking those, as the handle will still exist when you call ResetTrigger()? Or does ResetTrigger destroy a trigger's TriggerActions? |
| 10-02-2007, 03:07 AM | #3 |
I beileive ResetTrigger is a combination of: Code:
native TriggerClearActions takes trigger whichTrigger returns nothing native TriggerClearConditions takes trigger whichTrigger returns nothing I think it cleans registered events, too. Don't quote me on that, though. |
| 10-02-2007, 03:16 AM | #4 | |
Quote:
As I've seen, ResetTrigger function cleans the conditions and actions, but probably I'm wrong, in fact, that's one of the reason why I posted the code. |
| 10-02-2007, 03:20 AM | #5 |
I swear I tested ResetTrigger and it does not remove events, at least it won't prevent any memory use from their part. The deal is that, as a matter of fact, we don't really need dynamic triggers, would ellaborate if I wasn't about to sleep. |
| 10-02-2007, 03:23 AM | #6 |
It clears them, sure. But what does that mean? Aside from removing them from the trigger, what happens to them? In fact, I'm not even sure that TriggerRemoveAction even destroys the TriggerAction. |
| 10-02-2007, 07:15 AM | #7 |
Well in my little OnDamage thingy I create and destroy damage trigger for every unit, it does not seem to make any lag so there you go... |
| 10-02-2007, 07:27 AM | #8 | |
Quote:
|
| 10-02-2007, 07:34 AM | #9 |
Well all you need is a RemoveEventFromTrigger() function... But I guess there is none. I wonder what will Vexorian "elaborate" |
| 10-02-2007, 02:56 PM | #10 |
ResetTrigger doesn't remove events. TriggerClearActions 'removes' the actions from the trigger but doesn't actually remove the actions (I tested clear actions vs remove actions and clear actions caused a constant memory increase while remove did not). I can't speak for clear conditions. |
| 10-02-2007, 07:23 PM | #11 |
ConditionFuncs don't leak, as far as I know. Vexorian posted a thread about it called "Triggers and Conditions and Stuff", I believe. |
| 10-02-2007, 07:55 PM | #12 |
they are destroyed together with the trigger like the events. (so works only on DestroyTrigger()) ohhh ! ^^ my 777 post xD *party* |
| 10-03-2007, 02:04 AM | #13 |
Thanks for the comments, now I have one question for you guys: How can we do a good benchmark for the trigger recycler that I did?? Any suggestions?? or, as Vex said, we don't really need dynamic triggers, and this code is only useful with timers?? |
| 10-03-2007, 06:51 AM | #14 |
I'd say that it's completely useless with triggers. |
| 10-03-2007, 08:11 AM | #15 |
but it doesnt work properly =) (or O_O) |
