[Privoxy-devel] 0008-speed-up-processing-of-cgi_show_url_final_info

Lee ler762 at protonmail.com
Thu Aug 3 17:47:28 CEST 2023


Empty Message
-------------- next part --------------
From 0840f1ac45b2de57cabbca0293a014910fce1e46 Mon Sep 17 00:00:00 2001
From: Lee <ler762 at users.sourceforge.net>
Date: Tue, 1 Aug 2023 02:37:36 -0400
Subject: [PATCH 8/9] speed up processing of cgi_show_url_final_info

I want to check large host files against Privoxy to see if they're
already blocked or not - eg.
  https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
which is over 200K lines.

I _do_not_ want to check the timestamps of the config file, filter
files and action files 200K times in a row.  I want to get the darn
test done.
---
 jcc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/jcc.c b/jcc.c
index 4b69424b..e74687bf 100644
--- a/jcc.c
+++ b/jcc.c
@@ -5131,10 +5131,20 @@ static void serve(struct client_state *csp)
          }
       }
 
-      if (continue_chatting && any_loaded_file_changed(csp))
+/*
+ *    don't check for action/filter file changes if processing cgi requests
+ *     - operating system calls are slow
+ *     - accessing disk drives is even slower
+ *    so don't check timestamps on the config or action/filter files
+ *    or maybe only skip checking for file changes if show-url-final-info
+ *    is being called???
+ *
+ */
+      if (continue_chatting && !(csp->flags & CSP_FLAG_CRUNCHED) && any_loaded_file_changed(csp))
       {
          continue_chatting = 0;
          config_file_change_detected = 1;
+         log_error(LOG_LEVEL_INFO, "continue_chatting cleared, config_file_change_detected set");
       }
 #ifdef FEATURE_HTTPS_INSPECTION
       if (continue_chatting && client_use_ssl(csp) &&
-- 
2.39.0



More information about the Privoxy-devel mailing list