Python, Erlang, Map/Reduce

Here are the optimizations I would make:

(1) Initialize the regexp (as others have said)
r = re.compile(r"GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+) ")

(2) Filter out data that can’t match
matches = (r.search(line) for line in file("o10k.ap") if line.startswith("GET /ongoing/When/"))

(3) Add psyco
import psyco
psyco.full()

Posted by Hugh Brown