httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Khrustalev <d...@bog.msu.su>
Subject Re: BrowserMatch considered harmful
Date Sat, 14 Mar 1998 23:25:51 GMT

On Sat, 14 Mar 1998, Dean Gaudet wrote:

> I'm not seeing much of a performance difference between having those 5
> rules and not having them... like 1135 r/s vs. 1165 r/s across loopback.
> (zb 127.0.0.1 /index.html -p 8080 -k -c 2 -t 20)
> 

  Ok, it is an artefact of statistical profiler. Quantify was really a
luxury.

> And here's a patch which reduces the number of strcasecmp()s and
> table_get()s due to mod_setenvif to almost a minimum... but I don't see a
> big improvement with it.  Does it help you? 
> 

  I did something like this. Definitely useful. 

	-Dima

  PS. one more old patch:

--- mod_log_config.c~	Mon Sep 15 23:00:38 1997
+++ mod_log_config.c	Mon Oct  6 23:43:13 1997
@@ -663,9 +674,9 @@
 static int config_log_transaction(request_rec *r, config_log_state *cls,
                                   array_header *default_format)
 {
-    array_header *strsa;
     log_format_item *items;
     char *str, **strs, *s;
+    int *strl;
     request_rec *orig;
     int i;
     int len = 0;
@@ -677,7 +688,8 @@
 
     format = cls->format ? cls->format : default_format;
 
-    strsa = make_array(r->pool, format->nelts, sizeof(char *));
+    strs = palloc(r->pool, sizeof(char *) * (format->nelts));
+    strl = palloc(r->pool, sizeof(int) * (format->nelts));
     items = (log_format_item *) format->elts;
 
     orig = r;
@@ -689,20 +701,11 @@
     }
 
     for (i = 0; i < format->nelts; ++i) {
-        *((char **) push_array(strsa)) = process_item(r, orig, &items[i]);
+        strs[i] = process_item(r, orig, &items[i]);
     }
 
-    strs = (char **) strsa->elts;
-
     for (i = 0; i < format->nelts; ++i) {
-        len += strlen(strs[i]);
-    }
-
-    str = palloc(r->pool, len + 1);
-
-    for (i = 0, s = str; i < format->nelts; ++i) {
-        strcpy(s, strs[i]);
-        s += strlen(strs[i]);
+        len += strl[i] = strlen(strs[i]);
     }
 
 #ifdef BUFFERED_LOGS
@@ -710,13 +713,28 @@
         flush_log(cls);
     }
     if (len >= LOG_BUFSIZE) {
+        str = palloc(r->pool, len + 1);
+        for (i = 0, s = str; i < format->nelts; ++i) {
+            memcpy(s, strs[i], strl[i]);
+            s += strl[i];
+        }
         write(cls->log_fd, str, len);
     }
     else {
-        memcpy(&cls->outbuf[cls->outcnt], str, len);
+        for (i = 0, s = &cls->outbuf[cls->outcnt]; i < format->nelts; ++i)
{
+            memcpy(s, strs[i], strl[i]);
+            s += strl[i];
+        }
         cls->outcnt += len;
     }
 #else
+    str = palloc(r->pool, len + 1);
+
+    for (i = 0, s = str; i < format->nelts; ++i) {
+        memcpy(s, strs[i], strl[i]);
+        s += strl[i];
+    }
+
     write(cls->log_fd, str, len);
 #endif
 



Mime
View raw message