mIRC Home    About    Download    Register    News    Help

Print Thread
#174408 07/04/07 07:47 AM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
which one is faster?

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


or

Code:
.timer.command 1 0 perform




learn learn learn
Joined: Apr 2007
Posts: 2
V
Bowl of petunias
Offline
Bowl of petunias
V
Joined: Apr 2007
Posts: 2
In theory, neither...Time travels at the same speed laugh

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
what kind of question is that? why would you use $+() unnecessarily?


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #174415 07/04/07 11:15 AM
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
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.


Those who can, cannot. Those who cannot, can.
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
i'm just curious which one is faster..
simple but still can't answer directly


learn learn learn
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #174474 08/04/07 01:14 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
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.



Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
.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.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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 ;|


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Feb 2007
Posts: 75
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2007
Posts: 75
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


GigIRC Network Admin
irc.gigirc.com
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
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.


Link Copied to Clipboard