On 7/10/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
Jay Savage wrote: > foreach ('a'..'z') { > $recent{$_} = time; > sleep 1; > }Ouch. The OP did mention his limit was 200. So he must have more than 200 elements to scan. This algorithm will takes at least 3m20s, so it's hardly fast (which was one of the points of this exercise).
Ah, I just did the math. I think you're responding to the post with disappearing text. My follow-up made it clear that there were missing paragraphs in the original, and the code with sleep was just to simulate a user experience. Whatever the elemets are, it's unlikely that a person will access more thn one of them per second. So we want adding items to be speedy, but I figured in some time between adds to let the example work with time() as it would in a "real world" application. If you expect less than 1s between adds, use Time::HiRes. I hope that makes things a little clearer. -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!
