RE: What's Faster?
- Posted by Al Getz <Xaxo at aol.com> Jun 14, 2003
- 447 views
Derek Parnell wrote: > > > ----- Original Message ----- > From: "Al Getz" <Xaxo at aol.com> > To: "EUforum" <EUforum at topica.com> > Subject: What's Faster? > > > > Hello, > > > > What is faster during initialization: > > > > > > constant A1=#F > > > > or > > > > constant A1=15 > > > > In other words, does the interpreter read hex numbers > > faster then whole decimal integer numbers? > > And what about whole numbers between max_integer and #FFFFFFFF ? > > If there is any speed differences, it would be measured in microseconds > and > as constants only get initialized once in an application, you would not > really be able to detect the difference. In short, it isn't worth the > time > to worry about it. > > > > > Also, > > > > MySeq[5]=1 > > > > or > > > > MySeq[THE_NUMBER_FIVE]=1 > > > > > > This last one doesnt have to include the time it took > > to load the constant THE_NUMBER_FIVE. > > > > In other words, is it faster to read a number typed > > within the sequence bracket or is it faster to read > > the name of the constant, assuming at least 10 characters > > in the constants' name? > > Similar story here too. The speed up for using literals rather than > constants is also measured in microseconds. So unless you are doing this > operation many millions of times over, the loss in readability is not > worth > the effort. > > -- > Derek > > Hello, Thanks for the reply, but... The reason i asked the question: "What is faster" is because i wanted to know exactly that; 'what is faster'. Of course i dont mind if there is a slight difference when using this ONE time, but, as you could have guessed, i want to apply the answer to maybe 50,000 such cases in the same program. In this case: 50,000 times 10us equals 0.5 second difference in loading time, if in fact it is 10us, but if it's 1us THEN it doesnt matter. Since i have control over which way to do it, im not going to choose the longer time if i can help it, even if it's only 0.25 seconds instead of 0.5 seconds. It would also be nice to know the ratio, like 1.1 to 1, or 1.001 to 1. Any ideas? Al