From: Evan Martin (martine_at_danga.com)
Date: Mon Jan 26 2004 - 09:10:18 PST
I just graded (most of) the assignments, and I have a few comments.
I'll post them separately.
I took a point off for "data structures" for every group that used
the wrong data structure to store something.
Here's a little test. What is the difference between (loop A) and
(loop B):
arr = Array.new
hash = Hash.new
5000.times {
arr.push(rand()) # fill the array with 5000 randoms
hash[rand()] = true # fill the hash with ~5000 randoms
}
# (loop A) search the array a few times
5000.times {
arr.include? 0.5
}
# (loop B) search the hash a few times
5000.times {
hash.include? 0.5
}
Give up? Loop A takes about *four seconds* to run on my reasonably-fast
PC. Loop B feels almost instantaneous.
If you're sending, say, 16kbyte packets and doing 10mb/sec (that's not
that much data) you're processing on the order of 600 packets per
second. If you're doing something like loop A every time you receive a
packet, your program will simply be too slow to work.
(There are many cases where arrays are more suitable than hashes, too.
Please use each where appropriate.)
-- Evan Martin martine_at_danga.com http://neugierig.org _______________________________________________ Cse461 mailing list Cse461_at_cs.washington.edu http://mailman.cs.washington.edu/mailman/listinfo/cse461
This archive was generated by hypermail 2.1.6 : Mon Jan 26 2004 - 09:10:34 PST