So indexing just moves the processing time to the beginning instead of runtime object resolution and creates the flattest hierachy. Is that right ?
2011/9/20 Rey Bango <[email protected]> > Very cool. Thanks! :D > > > On Tue, Sep 20, 2011 at 12:09 PM, Dean Landolt <[email protected]>wrote: > >> >> >> On Tue, Sep 20, 2011 at 9:55 AM, Rey Bango <[email protected]> wrote: >> >>> Good question, Dean. This was presented to me this weekend by someone who >>> needs to work with the data as is. Not sure why but that's what they have to >>> work with. >>> >> >> >> Oh, I'd assumed this data was mocked because of the glaring bug in the >> original getChord function (the second for loop `i` clobbering the first) >> that would surface immediately on a set with more than one chord nested. >> >> >> >>> So regardless of the structure, what *I'm* personally interested in at >>> this moment is helping them optimize the traversal of the data. Can you >>> help? >>> >> >> >> Sure. I'd think the fastest traversal would be no traversal at all, so if >> they're in a position to keep an index around it'd drastically improve >> querying. Of course, if they can keep index state around they could probably >> just restructure the data as per my previous email. So if they can't index >> or rewrite, sadly, I don't think there's any way to get around the loops -- >> the best you could do is use the fastest looping technique available, a >> while loop from the tail: `i=array.length; while(i--) {}`. >> >> Here's a gist demonstrates both an index and optimized looping: >> https://gist.github.com/1229524 >> >> >> >> >> >> -- >> To view archived discussions from the original JSMentors Mailman list: >> http://www.mail-archive.com/[email protected]/ >> >> To search via a non-Google archive, visit here: >> http://www.mail-archive.com/[email protected]/ >> >> To unsubscribe from this group, send email to >> [email protected] >> > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
