conditional things. In every case, the idea was to check a variable
containing either a string or an int, against one or two other constants of
the same type, or select a default (2- or 3- way). The action for the
matched conditional was to assign a separate (preinitialized) variable with
a constant of the same type. Each conditional was implemented using each of
the three conditional constructs CF provides.
I have provided results below for two separate runs of 100,000 iterations
each below, for 24 records (two each for the 12 tests).
Overall results were that CFIF and IIF were similar in execution profile,
with CFIF having a slight edge when dealing with strings (presumably because
of the dynamic evaluation), and IIF having a slight edge with more than two
conditionals (presumably because it can be nested 'better'). CFSWITCH was
noticably slower across the board, particularly when dealing with strings
(which surprises me).
Test server was running ColdFusion Server Standard 6,1,0,63958 on top of
Apache/2.0.47, on a 600mHz AMD k6-2 machine with 256MB of RAM (my pathetic
dev server that also has to cope with serving files to the office, run
MySQL, and act as our internet gateway/router).
If anyone's interested in the test script or the excel spreadsheet of data,
I'd be happy to send it to you. Just email me off list.
time mechanism data ways
1103 CFIF Integers 2
1208 IIF Integers 2
2042 CFSWITCH Integers 2
2285 CFIF Integers 2
2669 IIF Integers 2
3763 CFSWITCH Integers 2
786 CFIF Strings 2
885 IIF Strings 2
891 CFIF Strings 2
966 IIF Strings 2
5756 CFSWITCH Strings 2
6722 CFSWITCH Strings 2
1173 IIF Integers 3
1452 IIF Integers 3
1611 CFIF Integers 3
2102 CFSWITCH Integers 3
2323 CFSWITCH Integers 3
3908 CFIF Integers 3
888 CFIF Strings 3
1089 IIF Strings 3
1908 CFIF Strings 3
2188 IIF Strings 3
7749 CFSWITCH Strings 3
11211 CFSWITCH Strings 3
Cheers,
barneyb
> -----Original Message-----
> From: Matthew Walker [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 11, 2004 3:39 PM
> To: CF-Talk
> Subject: RE: Which is quicker
>
> Interesting that people's ideas of good programming style are
> so different.
> I think we generally consider good style to be the way we as
> individuals
> normally do it, i.e. consistent style is good style. I would
> always use
> cfswitch where there are more than two static values to choose from,
> therefore to me that's good style. I would also write <cfif
> recordset.recordcount> and consider that elegant. Others find
> it appalling.
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

