I think I'd agree. It was really more between 2 and 3. As testing for the existence of the char is dumb. I was just wondering if replacenocase would be faster than replace.
On Wed, Aug 11, 2010 at 3:55 PM, Judah McAuley <ju...@wiredotter.com> wrote: > > I'd guess that option 3 is fastest. > > On Wed, Aug 11, 2010 at 12:50 PM, Medic <hofme...@gmail.com> wrote: > > > > True dat. What does your logic say about my three points? Which would be > > fastest in your opinion? > > > > > > On Wed, Aug 11, 2010 at 3:47 PM, Michael Dinowitz < > > mdino...@houseoffusion.com> wrote: > > > >> > >> Speed tests are always a false indicator of real work. I look at the 3 > >> points and just apply logic. But test results always look good no > >> matter. > >> > >> On Wed, Aug 11, 2010 at 11:55 AM, Medic <hofme...@gmail.com> wrote: > >> > > >> > haha, yes we _all_ know that the regex will be much faster. I was just > >> > wondering about the three points I made. > >> > > >> > On Wed, Aug 11, 2010 at 11:38 AM, Michael Dinowitz < > >> > mdino...@houseoffusion.com> wrote: > >> > > >> >> > >> >> The code that replaces each letter at a time will be much slower as > it > >> >> is looking through the entire string for a match for each letter. The > >> >> RegEx isn't doing any real work for the pattern match as it is > getting > >> >> everything. The replace is also not a lot of work as it's just > >> >> shifting everything within a certain range (lowercase) to a different > >> >> range (uppercase). Ascii shift, basically. > >> >> > >> >> > >> >> On Wed, Aug 11, 2010 at 11:30 AM, Medic <hofme...@gmail.com> wrote: > >> >> > > >> >> > Haha. Now THAT is a nice waste of space. I like how you test for > the > >> >> > existence of the letter before you replace it. > >> >> > > >> >> > This actually makes me want to run speed tests on what would be > >> faster: > >> >> > > >> >> > 1. testing for existence of lowercase letter - replacing lowercase > >> with > >> >> > uppercase using replace. > >> >> > 2. not testing and just replacing the lowercase with the uppercase > >> using > >> >> > replace. > >> >> > 3. just using replacenocase and replacing all letters with the > >> uppercase > >> >> > equiv. > >> >> > > >> >> > I bet if I showed this code to my boss he'd be like "whoa, that's > >> deep." > >> > >> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:324676 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm