Is there any difference (performance-wise, for example) between
<cfif not x EQ y>
and
<cfif x NEQ y>
?
If there is any difference at all, I'd doubt you'd notice it unless you are running this many, many, many times or unless x and y are really processor intensive somehow. I've never seen this flagged as a possible performance issue with Coldfusion since MX 7.
I would recommend using the format that is the most readable to you. Adding bugs to your code by making it hard to read will be more of an impact than the performance differences of these two formats.
Personally, I'd prefer to see the NEQ version as it reads better and is more common in CF.
<cfif x NEQ y>
In my head reads, "If x not equal to y..." Whereas....
<cfif NOT x EQ y>
reads "if not x equal to y..." doesn't make sense in English.
If you're really concerned about performance in these cases, you can use Compare or CompareNoCase are supposedly higher performing that EQ.
https://web.archive.org/web/20090212085046/http://livedocs.adobe.com/wtg/public/coding_standards/performance.html
But keep in mind those recommendations are from 5 years ago, and there is no more proof then this page that it is true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With