Which string operation is faster?

2006-01-30 Thread James Reily
Which of these executes faster, or do they each take the same amount of 
processing?  Are they equivalent under the hood?

   cfset foo = #var1#123

or

   cfset foo = var1  123

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230764
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Which string operation is faster?

2006-01-30 Thread Barney Boisvert
If you care about the speed difference, CFML is the wrong language to
be using.  CFML is designed to be fast enough, but primarily focus
on ease of development.  If you care about the handful of clock cycles
that might differentiate those two, you're better off with a platform
that is designed with performance foremost on the requirements list. 
I.e. C with assembler libraries.

Now if you want to know about readability, that's a far better
question, though I think it boils down primarily to personal style.

cheers,
barneyb

On 1/30/06, James Reily [EMAIL PROTECTED] wrote:
 Which of these executes faster, or do they each take the same amount of 
 processing?  Are they equivalent under the hood?

cfset foo = #var1#123

 or

cfset foo = var1  123


--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230765
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Which string operation is faster?

2006-01-30 Thread Andy Matthews
Difference appears to be nil. Initial compile time was slighty higher on the
#var1#123 method (62ms vs 47 ms for var1  123). Running each set of
code 10 times in a row averaged between 0 and 16ms for each.


Here's some code for testing:

cfset var1 = abc
!---
cfset foo = #var1#123
cfset foo = var1  123
 ---

!--- Setup timing test ---
cfset iterationCount = 1000
!--- Time an empty loop with this many iterations ---
cfset tickBegin = GetTickCount()
cfloop Index = i From = 1 To = #iterationCount#
cfset foo = var1  123
/cfloop
cfset tickEnd = GetTickCount()
cfset loopTime = tickEnd - tickBegin

!--- Report ---
cfoutputLoop time (#iterationCount# iterations) was: #loopTime#
milliseconds/cfoutput



!//--
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-

-Original Message-
From: James Reily [mailto:[EMAIL PROTECTED]
Sent: Monday, January 30, 2006 12:48 PM
To: CF-Talk
Subject: Which string operation is faster?


Which of these executes faster, or do they each take the same amount of
processing?  Are they equivalent under the hood?

   cfset foo = #var1#123

or

   cfset foo = var1  123


~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230766
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Which string operation is faster?

2006-01-30 Thread Munson, Jacob
Check out the function getTickCount:
http://www.techfeed.net/cfQuickDocs/?gettickcount
and Ben Forta's has a good example:
http://tinyurl.com/9m7vm

 -Original Message-
 From: James Reily [mailto:[EMAIL PROTECTED] 
 Sent: Monday, January 30, 2006 11:48 AM
 To: CF-Talk
 Subject: Which string operation is faster?
 
 Which of these executes faster, or do they each take the same 
 amount of processing?  Are they equivalent under the hood?
 
cfset foo = #var1#123
 
 or
 
cfset foo = var1  123

This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. A1.



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230767
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Which string operation is faster?

2006-01-30 Thread Charlie Griefer
I think Barney's really hit the nail squarely on the head (as per usual) :)

If there's a speed difference, it's certainly going to be negligible. 
Readability is the bigger factor (and since I'm quite certain
everyone's dying to know, I prefer cfset foo = var1  123 / :)

On 1/30/06, Munson, Jacob [EMAIL PROTECTED] wrote:
 Check out the function getTickCount:
 http://www.techfeed.net/cfQuickDocs/?gettickcount
 and Ben Forta's has a good example:
 http://tinyurl.com/9m7vm

  -Original Message-
  From: James Reily [mailto:[EMAIL PROTECTED]
  Sent: Monday, January 30, 2006 11:48 AM
  To: CF-Talk
  Subject: Which string operation is faster?
 
  Which of these executes faster, or do they each take the same
  amount of processing?  Are they equivalent under the hood?
 
 cfset foo = #var1#123
 
  or
 
 cfset foo = var1  123

 This transmission may contain information that is privileged, confidential 
 and/or exempt from disclosure under applicable law. If you are not the 
 intended recipient, you are hereby notified that any disclosure, copying, 
 distribution, or use of the information contained herein (including any 
 reliance thereon) is STRICTLY PROHIBITED. If you received this transmission 
 in error, please immediately contact the sender and destroy the material in 
 its entirety, whether in electronic or hard copy format. Thank you. A1.



 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230768
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Which string operation is faster?

2006-01-30 Thread James Reily
Thanks guys.  Charlie, I prefer your notation too -- it's definitey more 
readable.

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230769
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54