Evan Martin (evan) wrote in evan_tech,
Evan Martin

evening hack

Evening hack: searchable Stranger valentines.

(per lazyweb request by joshc)

Update: a bit more on the "technology". I tried a few different approaches for making this fast. One important one was that the actual entries themselves were originally generated using innerHTML -- for the non-Javascript-savvy, you can assign to this attribute DOM nodes and the HTML you provide is parsed -- but this was slow (likely because of the parsing) and instead I create a prototypical element straightforwardly in the HTML and then clone it and modify its text to create the valentines themselves.

The other major bottleneck seemed to be filling the page with these nodes. I eventually capped it (because you don't really need more than 75 nodes anyway) but before that I tried some other things, including iterating through the list in reverse and repeatedly prepending rather than doing presumably the O(n^2) repeated appends.

I was also thinking of doing some fancy searching (in fact, my original idea involved using XMLHttp to have the processing done on a server) but when I tried the simple "search every entry" approach it appeared to be fast enough to work.

  • blog moved

    As described elsewhere, I've quit LiveJournal. If you're interested in my continuing posts, you should look at one of these (each contains feed…

  • dremel

    They published a paper on Dremel, my favorite previously-unpublished tool from the Google toolchest. Greg Linden discusses it: "[...] it is capable…

  • treemaps

    I finally wrote up my recent adventures in treemapping, complete with nifty clickable visualizations.

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.