Interesting, thanks.  I thought I had done that before and received an error about not being able to nest the CFIF tag inside another tag.  But it is very possible I was using a CFINPUT instead of a regular INPUT.  I was probably on v4.01 at the time as well.
______________________________________________________
  <file:///E:/EUColor.gif>
Bill Grover
Manager, Information Systems Phone: 301.424.3300 x3324
EU Services, Inc. FAX: 301.424.3696
649 North Horners Lane E-Mail:   <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
Rockville, MD 20850-1299 WWW:   <http://www.euservices.com/> http://www.euservices.com
______________________________________________________

-----Original Message-----
From: David Ashworth [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 9:00 AM
To: CF-Talk
Subject: RE: Which is quicker

you wouldn't have to code it twice using CFIF

just have the CFIF around the checked parameter

<input type="checkbox" name="cbox" value="yes" <cfif x=y>checked</cfif>>

-----Original Message-----
From: Bill Grover [mailto:[EMAIL PROTECTED]
Sent: 12 February 2004 12:47
To: CF-Talk
Subject: RE: Which is quicker

The one place I've found that I really like the IIF is to use it in
areas like the following code sample:

<input type="checkbox"
       name="#REQUEST.cReorderFormArtPrefix##ReorderJob.ljob#"
       value="Yes"
       #IIF(laReorderJobs[lnLoop][REQUEST.cReorderFormArtPrefix] NEQ "",

            DE("CHECKED"), DE(""))#>

I found using it this way is much more readable in my code then using
<CFIF> and having to code the almost identical <INPUT> tag twice with
only the "CHECKED" option in or out.
______________________________________________________  
Bill Grover
Manager, Information Systems Phone:301.424.3300 x3324
EU Services, Inc. FAX:301.424.3696
649 North Horners Lane E-Mail:[EMAIL PROTECTED]
Rockville, MD 20850-1299 WWW:http://www.euservices.com
______________________________________________________

-----Original Message-----
From: Matthew Walker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 11, 2004 6:27 PM
To: CF-Talk
Subject: RE: Which is quicker

Really? I'm getting about 50 and 150ms respectively. So for me while
iif()
is slower it's only one hundredth of a millisecond difference i.e. way
below
anything I'd worry about. So it's a style thing then.

-----Original Message-----
From: Tom Kitta [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 February 2004 11:11 a.m.
To: CF-Talk
Subject: RE: Which is quicker

You may get these results due to use of de(), run this code, which I
think
is more fair:

<cfset temp = getTickCount()>

<cfoutput>
<cfloop index="i" from="1" to="10000">
<cfif i mod 2>1<cfelse>2</cfif>
</cfloop>
</cfoutput>

<cfoutput><h1>#temp-getTickCount()#</h1></cfoutput>

<cfset temp = getTickCount()>

<cfoutput>
<cfloop index="i" from="1" to="10000">
#iif(i mod 2, 1, 2)#
</cfloop>
</cfoutput>

<cfoutput><h1>#temp-getTickCount()#</h1></cfoutput>

I got 15 - 16 as results for both of them with some variations both ways
which I discard as noise.

TK
  -----Original Message-----
  From: Matthew Walker [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, February 11, 2004 5:57 PM
  To: CF-Talk
  Subject: RE: Which is quicker

  My test indicates iif() is about 400% slower. But the real issue is
code
  readability. If you think it's more readable in any or all
circumstances,
I
  say go for it. Personally, I think this example demonstrates it is
less
  readable. There are probably other example that show it in a better
light.

  Here's my sample:

  <cf_stopwatch>

  <cfoutput>

  <cfloop index="i" from="1" to="10000">

  <cfif i mod 2>!<cfelse>?</cfif>

  </cfloop>

  </cfoutput>

  </cf_stopwatch>

  <cf_stopwatch>

  <cfoutput>

  <cfloop index="i" from="1" to="10000">

  #iif(i mod 2, de("!"), de("?"))#

  </cfloop>

  </cfoutput>

  </cf_stopwatch>

  -----Original Message-----
  From: Tom Kitta [mailto:[EMAIL PROTECTED]
  Sent: Thursday, 12 February 2004 10:47 a.m.
  To: CF-Talk
  Subject: RE: Which is quicker

  I don't know why people don't like iif (immediate if), it is as quick
as
  cfif and takes only one line. For simple things, like "if x < y print
true
  else print false", I think using iif makes code shorter without
sacrificing
  clarity and speed.

  If you don't believe iif is fast then I encourage you to write a small
test
  and see for yourself.

  TK
    -----Original Message-----
    From: Matthew Walker [mailto:[EMAIL PROTECTED]
    Sent: Wednesday, February 11, 2004 5:34 PM
    To: CF-Talk
    Subject: RE: Which is quicker

    cfswitch is both quicker and more elegant. The only downside is that
it
    doesn't handle dynamic values.

    Iii() is one of those functions, like evaluate(), usage of which is
    generally discouraged.

    -----Original Message-----
    From: Parker, Kevin [mailto:[EMAIL PROTECTED]
    Sent: Thursday, 12 February 2004 10:30 a.m.
    To: CF-Talk
    Subject: Which is quicker

    Can I get a little advice on which is quicker or which is the
preferred
  way
    of programming - there are 8 items to select from:

    CFIF, CFCASE or IIF

    TIA!

    +++++++++++++++++++
    Kevin Parker
    Web Services Manager
    WorkCover Corporation

    p: 08 8233 2548
    e: [EMAIL PROTECTED]
    w: www.workcover.com
    +++++++++++++++++++

************************************************************************
    This e-mail is intended for the use of the addressee only. It may
    contain information that is protected by legislated confidentiality
    and/or is legally privileged. If you are not the intended recipient
you
    are prohibited from disseminating, distributing or copying this
e-mail.

    Any opinion expressed in this e-mail may not necessarily be that of
the
    WorkCover Corporation of South Australia. Although precautions have
    been taken, the sender cannot warrant that this e-mail or any files
    transmitted with it are free of viruses or any other defect.

    If you have received this e-mail in error, please notify the sender
    immediately by return e-mail and destroy the original e-mail and any
    copies.

************************************************************************

      _____

    _____

  _____
  _____
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to