Fix O(n^2) performance when parsing a big pile of extrainfos
commit02a650786b21e4f3c255d686a3b5df875b2d66b5
authorNick Mathewson <nickm@torproject.org>
Thu, 10 May 2012 21:27:16 +0000 (10 17:27 -0400)
committerRoger Dingledine <arma@torproject.org>
Thu, 10 May 2012 21:41:31 +0000 (10 17:41 -0400)
treea313aa8848622dfa7fcb3bdd6fc7630002b48ae5
parent62f8e3926d62ff4aaefedfe89355f04f3a8d74fa
Fix O(n^2) performance when parsing a big pile of extrainfos

We were doing an O(n) strlen in router_get_extrainfo_hash() for
every one we tried to parse.  Instead, have
router_get_extrainfo_hash() take the length of the extrainfo as an
argument, so that when it's called from
extrainfo_parse_from_string(), it doesn't do a strlen() over the
whole pile of extrainfos.
changes/bug5828 [new file with mode: 0644]
src/or/router.c
src/or/routerparse.c
src/or/routerparse.h