- Brian Rinaldi
blog: http://www.remotesynthesis.com/blog
ColdFusion Open Source List: http://www.remotesynthesis.com/cfopensourcelist
Boston CFUG - http://www.bostoncfug.org
From: "Brian Kotek" <[EMAIL PROTECTED]>
Sent: Thursday, May 18, 2006 2:19 PM
To: [email protected]
Subject: Re: [CFCDev] CFINVOKE vs. Evaluate
The point is that in virtually all cases:
1. evaluate() is slower
2. there is no reason to use it
3. it is more difficult to read and understand
4. it demonstrates a lack of understanding of the features of the language
Resent without the "SPAM" flags ;)
I've actually posted metrics on this before – and you're pretty much right. The performance penalties of using evaluate are trivial at best, and often times non-existent. The metrics below demonstrate that, given server conditions, the evaluate code can even perform faster than inline code Anyway, it's *very* clear from the results that the overhead of evaluate is largely over-hyped. Also, attached are the two test files I used to generate the metrics.
Simple _expression_ - 10,000 Iterations
Inline
Evaluate
Run 1
32
62
Run 2
31
78
Run 3
16
62
Run 4
31
79
Run 5
31
63
Average
28.2
68.8
Simple _expression_ - 100,000 Iterations
Inline
Evaluate
Run 1
328
437
Run 2
312
828
Run 3
297
485
Run 4
313
828
Run 5
312
578
Average
312.4
631.2
Object Invocation - 1000 Iterations
Inline
Evaluate
Run 1
1830
2190
Run 2
1328
1391
Run 3
1437
1078
Run 4
1313
1843
Run 5
1843
1688
Average
1550.2
1638
Object Invocation - 10000 Iterations
Inline
Evaluate
Run 1
14375
11672
Run 2
14250
20187
Run 3
17140
20828
Run 4
18328
11735
Run 5
20453
20125
Average
16909.2
16909.4
Roland
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Brian Rinaldi
Sent: Thursday, May 18, 2006 11:05 AM
To: [email protected]
Subject: SPAM: Re: [CFCDev] CFINVOKE vs. Evaluate
I only recently started watching this thread, but this seems to me that the "avoid evaluate()" rule generally doesn't have much documented justification (though I am not arguing that it isn't valid - just that I have rarely seen much documentation on the differences - if I missed some earlier in this thread I apologize in advance). The ColdFusion MX Coding Guidlines only says the following under Performance "Don'ts":
"Don't use evaluate() - Avoidevaluate()unless there is no other way to write your code (and there is almost always another way to write your code)."
A Google search only comes up with the following posts (the first being recent and the second a couple years old):
http://cfprimer.blogspot.com/2005/03/avoid-evaluate.html
http://www.sitepoint.com/blogs/2004/02/19/running-performance-metrics-on-coldfusion-functions-and-operators/
An MXNA search comes up with some more recent posts:
http://www.succor.co.uk/index.cfm/2006/4/13/Avoid-evaluate-always
http://www.blogoffusion.com/index.cfm/2006/4/18/Structure-style-evaluation-rocks
However, nobody seems to offer specific metrics (except for one that came to the conclusion that the differences were minimal). Let me be clear, I am not arguing that this isn't a completely valid best practice - I am sure at some point it was based upon some documented metrics, but it would be nice to see them.
- Brian Rinaldi
blog: http://www.remotesynthesis.com/blog
ColdFusion Open Source List: http://www.remotesynthesis.com/cfopensourcelist
Boston CFUG - http://www.bostoncfug.org
From: "Nick Tong - TalkWebSolutions.co.uk" < [EMAIL PROTECTED]>
Sent: Thursday, May 18, 2006 10:49 AM
To: [email protected]
Subject: Re: [CFCDev] CFINVOKE vs. Evaluate
On 18/05/06, Peter Bell wrote:
> So, would cf invoke actually be any faster?
I think this can depend on if you have initiated the object into memory i.e.
in this case then i believe it is faster
--
Nick Tong
web: http://talkwebsolutions.co.uk
blog: http://succor.co.uk
shorturls: http://wapurl.co.uk
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting ( www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
