Classes (1)  /  ColdFusion (14)  /  ColdFusion Jobs (2)  /  General (7)  /  JQuery (7)  /  Quick and Dirty (3)  / 
Search Blog






Adobe Community Expert in ColdFusion


Adobe Ceritfied Instructor


CTT+ Certified Technical Trainer


Hosted By:

Alurium Hosting

Powered by BlogCFM v1.14

09 November 2011
a different way to alternate
We've all found a billion ways to achieve some kind of alternating event in our websites, whether it's alternating row colors, content or a myriad of other things..

In the ColdFusion world we use the CF Mod() function alot.. but did you know how much overhead it actually creates? For each iteration it must divide the numbers in question and look at the remainder. Based on that remainder the Mod is either odd or even...


I stumbled on to a better way, ColdFusion has a function called BitAnd(), instead of dividing numbers this works at the bit level and it's substantially faster:

Ben Nadel does a great overview here:

I've found a significant performance increase, especially with large data outputs needing alternating something..

Posted by admin at 10:18 AM | Link | 0 comments

No comments found.

Commenting has been disabled for this entry.


© 2011 Scott Stewart / SSTWebworks
Design by Contented Designs