| 03-06-2009, 02:11 AM | #1 |
http://www.thehelper.net/forums/showthread.php?t=78392 Thoughts? I have really no experience in benchmarking. |
| 03-06-2009, 02:52 AM | #2 |
I think it's the best you can get, without a struct loop and a static timer. It's like TT, but slightly slower. But you can specify a period! That sounds good to me. |
| 03-06-2009, 02:57 AM | #3 |
From the looks of it he uses triggers, is that faster than using function interfaces or is it kind of the same thing? |
| 03-06-2009, 06:07 AM | #4 |
You should see what function interfaces compile to... |
| 03-06-2009, 06:14 AM | #5 |
> It's like TT, but slightly slower. He says KT is the fastest (that's what the benchmarks point). Is it really faster than direct H2I? |
| 03-06-2009, 11:36 AM | #6 |
Rapid Timers is faster. It's not so much that these methods are faster than direct H2I, but that timer timeouts are slower than TriggerEvaluate. Meh, just use TU really. Unless you need speed. Then you don't use a timer system, just one timer in your system running everything, because you're doing physics or something similar (or you don't need the speed). |
| 03-06-2009, 11:45 AM | #7 |
Hmmm..I like TU much more.... its just more flexible ... And this uses evaluate ....i dont want more evaluates in my map as necessary :> |
| 03-06-2009, 02:14 PM | #8 | ||||||||||||||||||||
struct with loops: Easy, readable, fast. struct with loops + trigger evaluate : harder to read, slower. struct with loops + textmacro: Terribly harder to read, harder to code, as fast as struct with loops or even slower. Purple/Red timer utils = Fastest timer attach method on earth for timers with flexible timeouts, that may be large or small. H2I+array lookup is a lower bound if you want timers with flexible timeouts. The other methods work only when the timeout is small. If the timeout is small and the timer is periodic, then it is retarded to even test TimerUtils with it. Just use an array and a loop, really. Besides of being so darn easy, it IS the fastest method. A limit on different timer periods = bad. Please notice that speed is meaningless if the method does not do the job correctly. Else we all would be using just globals to attach, there's a fast method (like key timers) that doesn't really work on MUI (just like key timers) , please pay attention to this: Let's say I want to make a spell that does something after 5 seconds I cast the spell, something like this: JASS:function after2 takes nothing returns nothing local timer t= GetExpiredTimer() local struct f = struct( GetTimerData(t) ) call f.do() call ReleaseTimer(t) endfunction function oncast takes nothing returns nothing local struct f= struct.generate() local timer t= NewTimer() call TimerStart(t, 5.0, false, function after2) endfunction Table:
It works ok. Now if I use "key timers": Table:
That's the sad reality. This method only works for small timeouts. So I once tried to make a way to use only one Timer even on situations that require large, flexible time outs. And I invented TimeLib and following MagicTimers. Know this, I am absolutely sure that the only ways to have flexible, possibly-large and accurate timeouts are to use H2I or Griffen's sucky hack stuff. Anything else is slow, inaccurate or both. Oh and I have my doubts about the benchmarks I wll work on them later. --------- Edit: So seriously, I have to be tough on this because that thehelper thread is full of false claims and people blindingly following them, these are the conclusions: a) keytimers are absolutely, undeniably slower than timer utils. So most likely his benchmarks are flawed. I am gonna review them up later. Edit: More details later. b) keytimers are terribly limited. For all practical purposes if you want to use keytimers in your map, make sure to be the only one making code that use them. Else the varied timeouts used by different spells will make the timeout or the small instance limit get consumed. c) keytimers are not MUI, if you use a larger than (let's say) 0.5 seconds timeout, you better use this timeout on only one spell instance at the same time, if you don't want your timing to get completely innacurate. d) Even red timer utils are less limited than them. e) The main difference between TimerUtils and this method is that if you start a timer and attach something to it using TimerUtils then tell the timer to last X seconds, it is guaranteed that the timer will do its work after X seconds. This is not the case with KT. You cannot have different timeouts, you can't have a timeout of 1.333 (for example if you want to run something after a unit's animation...) You can't have two things running at the same time if their timeouts are too close. Etc. KT are simply not accurate. This method works wonders when the timeout is <= 0.05 then it is just garbage. If you want to use this method for small timeouts, then use TT (cause it is faster since it doesn't have to have multiple timeouts) or like Griffen said RapidTimers (which are allegedly faster than TT but they are mostly the same thing) Or much better, have your own array and a loop, since that's definitely the fastest method. |
| 03-06-2009, 02:36 PM | #9 |
Gah, and I spent a whole 5 minutes switching my spells to KT. Now I gotta switch 'em back. Please, people, stop with the big revelations! |
| 03-06-2009, 09:34 PM | #10 |
Anyway, some oddities with his benchmarks: 1) I am not sure if executions per seconds works at all with timer systems, if you think about it, it may not make a lot of sense that they did. Though to prove this wrong I'll need to work more. 2) In KT's benchmark: JASS:
call KT_Add(function DoExample, Data, 1.0)
In H2I+subtraction benchmark: JASS:
set t=NewTimer()
call SetTimerData(t,Data)
call TimerStart(t,0.0,true,function DoExample)3) The benchmarks are flawed by definition. Let me explain, to test his system he is using a single timeout. So his system would do all executions but only call the function that gets the timer's id once... Instead the other systems don't get this advantage, since they can't recognize that the interval is the same, and they don't separate things like that. So I think the reason KT wins in benchmarks is because of the terrible flaw I mentioned in the last post. If it wasn't for that flaw, the timer would expire at different moments for each function and would have to do all the operations for each instance. Unfortunately, it doesn't work correctly, this boosts its performance, however it makes it a broken system. He'll have to choose between making KT actually work or keeping them as a 'fast' thing. --- Edit: Some better conclusions: It is like Griffen said, it is about the timeout being slower than no timeout. It is true that KT are the fastest method - for his benchmark - Consider his benchmark, it involves running a lot of timers with the same timeout. His method saves operations, but it is only an improvement for that specific benchmark. If you want the timer system that will blow competition away in HIS benchmark then KT are the fastest one. However, in a real life scenario: a) The bug with KT would be fixed. b) There fore there would be one timeout per TriggerEvaluate, unlike what there is right now. c) There would also be a call to that function that gets the attached timer. Besides of the array lookups etc. d) It will be (and I am 100% sure) slower than Red/Purple timer utils. This system is perfect for performing the best at this benchmark, however in a real life scenario it is either slower or less accurate, enjoy. Edit: If it is not clear enough, the reason KT is faster in those benchmarks is also a critical bug that makes this idea unusable on large timeouts. It should still work ok with small timeouts, but TT works ok with small timeouts as well and it is faster... |
| 03-06-2009, 10:27 PM | #11 | |||||||||||||||||||||||||
Taking a look at the paper: Quote:
Quote:
Right. Quote:
Quote:
Quote:
The only reason not to use gamecache for timer attaching is that there are better methods. But gamecache does work, just use it to attach an integer on it which would probably be a struct. DOTA in a way does this already. It works, it is "stable", speed could improve. Quote:
Quote:
We are talking about spells here, and neglecting the visual part is really a bad mistake to make. Timers need to be accurate when you are synchronizing animation and movement and stuff. Sometimes you need something to happen exactly 0.45 seconds after a special effect has been created. Period. If this code is not executed after 0.45 seconds it will look bad. Balance is far from being the only problem here, But for large timeouts it truly is. If you want to make a spell like flame strike. Sometimes it will do the damage after 3 seconds and sometimes after 0.4 seconds, this is just wrong. Quote:
Quote:
Quote:
That's the theory, even though he already knew of the flaw, he'll continue pushing for it: Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
b) You can't use GetData() methods for flexible timeouts as I have already shown. Quote:
Quote:
Either way, why is he calling the single-timer systems "multi instance timer systems"? That's ridiculous. Then he goes to complaint about ABCT, which is actually a fast system, and different to KT in the sense it actually works, then... Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Yes, probably Key Timers 1 was faster than TT, because of the lack of TriggerEvaluate. This also measn that array+loop is way faster than they all. With the addition it doesn't need horrid textmacros. |
| 03-06-2009, 11:04 PM | #12 |
At least Iron_Doors knew what the hell he was talking about to some extent and when people pointed out he was wrong, he gladly took in the advice. -Av3n |
| 03-06-2009, 11:04 PM | #13 |
who? edit: Ah. BTW Purple TimerUtils is actually a good thing. Mostly because he managed to get the hashing stuff inlineable. Purple is almost as fast as Red, in fact until a recent update it was faster than Red. And it is also significantly safer than Red. The answer to the timer systems feud was to make something like TimerUtils, which was implementation independent, this way things can evolve just fine. For example, what if blizz releases a SetHandleUserData native? With timer utils we would just replace the SetTimerData function and it would get inlined... |
| 03-06-2009, 11:30 PM | #14 |
Ha this thief is still around, funny. Nice seeing his system getting raped ;) |
| 04-04-2009, 04:58 PM | #15 |
Didn't feel like creating a new thread, sorry for reviving this. Since he updated the system, he says that it is now the fastest timer system in existence, being ~22% over the speed of Timer Utils Red. I have no idea how it is possible, can someone benchmark and confirm it? It seems like he doesn't want to show his test triggers. |
