mIRC Homepage
Posted By: learn3r which is faster? - 07/04/07 07:47 AM
which one is faster?

Code:
$+(.timer,.,command) 1 0 perform


or

Code:
.timer.command 1 0 perform


Posted By: Variable Re: which is faster? - 07/04/07 10:51 AM
In theory, neither...Time travels at the same speed laugh
Posted By: jaytea Re: which is faster? - 07/04/07 11:04 AM
what kind of question is that? why would you use $+() unnecessarily?
Posted By: Kardafol Re: which is faster? - 07/04/07 11:15 AM
He could be using it like this:
Code:
$+(.timer,.,%command) ....

But then, I'd guess it'd be to make his code harder to read (since he doesn't use a variable in his example). Which there aren't many reasons to do, since I've learned from a few snippets on how to do stuff before, and I'm sure many others have aswell.
Posted By: jaytea Re: which is faster? - 07/04/07 11:20 AM
well yeah his second example is only valid if .timer.command is all plaintext with no identifiers/variables. if theres something of that nature then clearly you don't have a ".timer.%command" alternative :F
Posted By: Riamus2 Re: which is faster? - 07/04/07 03:55 PM
Any speed difference is negligible. It's pointless to do the $+() example if you don't need to. If you want to connect a variable or an identifier like $nick to it, then you only have the one choice.

You can always check speed differences by using //echo -a $ticks and looping through what you are testing many times, then repeat with the other option. It will give you an idea of which is faster.
Posted By: RusselB Re: which is faster? - 07/04/07 07:27 PM
I agree that the speed difference is going to be negligible, but there should be a difference, since mIRC would have to evaluate the information provided in $+(.timer.command) before proceeding with the actual execution of the timer sequence, versus the 2nd version where .command is being used as a name, and mIRC doesn't need to evaluate this.

I think (although I haven't tested this) that the evaluation required in the first timer code would be done each time the timer runs, rather than just once, as would be the case with just the name.
Posted By: learn3r Re: which is faster? - 08/04/07 06:35 AM
i'm just curious which one is faster..
simple but still can't answer directly
Posted By: jaytea Re: which is faster? - 08/04/07 12:40 PM
your question doesn't deserve a direct answer smirk did you not read the above replies? you either need $+() or you don't. if you don't need it.. don't use it! it's as simple as that ;S stop worrying about speed for such meaningless bits of code and start focusing on what is suitable
Posted By: OrionsBelt Re: which is faster? - 08/04/07 01:14 PM
It's not about what is better to use, what he should worry about, or what he can or can not ask. He is asking what is faster, and the only one that gave a decent reply to his question is Riamus.

Quote:
You can always check speed differences by using //echo -a $ticks and looping through what you are testing many times, then repeat with the other option. It will give you an idea of which is faster.


Posted By: hixxy Re: which is faster? - 08/04/07 02:12 PM
.timer.command doesn't have to evaluated, so it will be faster than $+(.timer,.,command) or .timer $+ . $+ command

There is absolutely no point whatsoever in using a concatenation operation here though.
Posted By: Riamus2 Re: which is faster? - 09/04/07 04:33 PM
Originally Posted By: OrionsBelt
It's not about what is better to use, what he should worry about, or what he can or can not ask. He is asking what is faster, and the only one that gave a decent reply to his question is Riamus.


RusselB also gave an answer that would help. Though he didn't specifically say that $+() would take a little more time, I think it's easy to see that that is what he was meaning.
Posted By: jaytea Re: which is faster? - 09/04/07 05:50 PM
Originally Posted By: OrionsBelt
It's not about what is better to use, what he should worry about, or what he can or can not ask. He is asking what is faster, and the only one that gave a decent reply to his question is Riamus.



i feel that telling him which is faster without any more explanation would encourage him to ask more questions like this and intensify this poor way of thinking. speed could well be considered an important factor in certain circumstances, but certainly not here and i think he should first learn where it should be considered before worrying about it ;|
Posted By: Trixar_za Re: which is faster? - 11/04/07 05:52 AM
Originally Posted By: Variable
In theory, neither...Time travels at the same speed laugh


Er, no it doesn't. Read up on some current Sciencific advancements or atleast Quantum and Special Relativity Theory. You seem to be stuck on Newton's Laws of motion (and it's absolute time).

Btw, Please stay with the topic and add some real help. By going around just posting, trying to be funny or smart is the quickest way to make people not like you or give you a mental whipping wink
Posted By: DJ_Sol Re: which is faster? - 11/04/07 07:47 PM
lol Trixar is right, but in this application time does move at the same speed.

Concerning the initial question, yes, the difference is neglible when looking at one line of code, but my main concern is really efficiency. If there is no point in making mIRC perform commands for identifiers then why do it? One line is fine, but if a person adopts this method then there are way more than one line doing this and they add up quick.

My philosophy is make mIRC work as little as possible in every tiny bit of code you write because it all adds up.

$+ is used to combine an identifer with something, if it's not an identifier then you can just hardcode it.
© mIRC Discussion Forums