Browse Source

r11858@catbus: nickm | 2007-02-21 00:27:44 -0500
As a trivial optimization, remove a redundant call to router_have_minimum_dir_info. This might shave 2% on some systems by according to some profilers.


svn:r9610

Nick Mathewson 17 years ago
parent
commit
2a4fc8533c
3 changed files with 9 additions and 2 deletions
  1. 4 0
      ChangeLog
  2. 4 1
      src/or/circuituse.c
  3. 1 1
      src/or/routerlist.c

+ 4 - 0
ChangeLog

@@ -53,6 +53,10 @@ Changes in version 0.1.2.8-alpha - 2007-??-??
     - Add STREAM_BW events to report per-entry-stream bandwidth use. (Patch
       from Robert Hogan.)
 
+  o Minor bugfixes (performance):
+    - Call router_have_min_dir_info half as often.  (This is showing up in
+      some profiles, but not others.)
+
   o Minor features:
     - Remove some never-implemented options.  Mark PathlenCoinWeight as
       obsolete.

+ 4 - 1
src/or/circuituse.c

@@ -445,7 +445,10 @@ circuit_build_needed_circs(time_t now)
   connection_ap_attach_pending();
 
   /* make sure any hidden services have enough intro points */
-  if (router_have_minimum_dir_info())
+  /* XXXX012 circuit_build_needed_circs is only called at all if
+   *         router_have_minimum_dir_info is true; this check is redundant,
+   *         and it appears to show up on some people's profiles. */
+  if (1 || router_have_minimum_dir_info())
     rend_services_introduce();
 
   if (time_to_new_circuit < now) {

+ 1 - 1
src/or/routerlist.c

@@ -4154,7 +4154,7 @@ static int need_to_update_have_min_dir_info = 1;
 int
 router_have_minimum_dir_info(void)
 {
-  if (need_to_update_have_min_dir_info) {
+  if (PREDICT_FALSE(need_to_update_have_min_dir_info)) {
     update_router_have_minimum_dir_info();
     need_to_update_have_min_dir_info = 0;
   }