Or extremely high traffic on a given page yea... Most of the time I don't generally put a lot of thought into which is more (or less) efficient -- I write what's easiest to implement and easiest to change or expand on later. When I have a project that's having a problem handling the load (which is fairly uncommon), then I look for tweaks to make it more efficient.
------ Original Message ------ From: Dan Blackman <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Aug 28, 2003 09:56 AM Subject: RE: structures vs arrays >It's also negligible unless you are working with hundereds of thousands >of rows in MHO. You are not going to see the difference until you are >hitting a sizable recordset... > >My 2 c > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On >Behalf Of S.Isaac Dealey >Sent: Thursday, August 28, 2003 9:41 AM >To: [EMAIL PROTECTED] >Subject: Re: structures vs arrays > > >> Which one is more efficient at retrieving data: structure >> or an array? > >Depends what you're doing with it... > >A structure is faster at finding a key than it is to find a given string >within an array... i.e. > >idx = structkeyexists(mystruct,"blah") > >vs. something like this: > >idx = listfind(arraytolist(myarray),"blah") > >or worse > >idx = 0; >for (x = 1; x lte arraylen(myarray); x = x + 1) { > if (myarray[x] is "blah") { idx = x; break; } >} > >I believe arrays are slightly faster when looping over them, i.e. > ><cfloop index="x" from="1" >to="#arraylen(myarray)#"></cfloop> > >vs. > ><cfloop item="x" collection="#mystruct#"></cfloop> > >and I'm pretty sure getting a single value from an array > >myarray[3] > >is faster than getting a single value from a structure > >mystruct["blue"] > >I hope that's helpful. :) > >s. isaac dealey 972-490-6624 > >team macromedia volunteer >http://www.macromedia.com/go/team > >chief architect, tapestry cms http://products.turnkey.to > >onTap is open source http://www.turnkey.to/ontap > > >----------------------------------------------- >To post, send email to [EMAIL PROTECTED] >To unsubscribe: > Send UNSUBSCRIBE to [EMAIL PROTECTED] >To subscribe / unsubscribe: http://www.dfwcfug.org > >----------------------------------------------- >To post, send email to [EMAIL PROTECTED] >To unsubscribe: > Send UNSUBSCRIBE to [EMAIL PROTECTED] >To subscribe / unsubscribe: http://www.dfwcfug.org ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org
