From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Robert J. Chassell" Newsgroups: gmane.emacs.devel Subject: Re: RMAIL slows Date: Tue, 12 Apr 2005 13:49:23 -0400 (EDT) Message-ID: References: Reply-To: bob@rattlesnake.com NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1113329987 23850 80.91.229.2 (12 Apr 2005 18:19:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 12 Apr 2005 18:19:47 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 12 20:19:41 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DLPy2-0004AX-9b for ged-emacs-devel@m.gmane.org; Tue, 12 Apr 2005 20:18:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DLPYF-0002c0-Dy for ged-emacs-devel@m.gmane.org; Tue, 12 Apr 2005 13:51:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DLPXv-0002aO-96 for emacs-devel@gnu.org; Tue, 12 Apr 2005 13:51:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DLPXt-0002Zq-KZ for emacs-devel@gnu.org; Tue, 12 Apr 2005 13:51:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DLPXt-0002ZY-A7 for emacs-devel@gnu.org; Tue, 12 Apr 2005 13:51:29 -0400 Original-Received: from [69.168.108.225] (helo=rattlesnake.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DLQ0I-0007OS-SP for emacs-devel@gnu.org; Tue, 12 Apr 2005 14:20:51 -0400 Original-Received: by rattlesnake.com via sendmail from stdin id (Debian Smail3.2.0.115) Tue, 12 Apr 2005 13:49:23 -0400 (EDT) Original-To: Stefan Monnier In-reply-to: (message from Stefan Monnier on Fri, 08 Apr 2005 18:57:23 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:35908 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35908 Stefan Monnier wrote, ... re_match_2_internal is a function that can easily take an insane amount of time ... So a good thing to do is to look at the regexp that's being matched (typically: look up the backtrace to see the value of the `string' argument to search_buffer, then do "print string" and then "xstring" to see the actual string). Thank you. This and Kim's message are what I need. I cannot figure out why things go wrong. They look OK to me. ... let the code run until the end of re_match_2_internal. If it's immediate it means the problem is maybe not in the time taken in each call to re_match_2_internal, but rather in the number of calls. When I evoke `finish' when the program has stopped at re_match_2_internal, it runs fairly quickly to then stop in re_search_2 in regex.c, line 4338, at the second line of if (val >= 0) return startpos; even though I do not have a break point there. (The only breakpoint for this run is in re_match_2_internal at regex.c:4828) I am returning fairly quickly from `finish' so the problem may be in the number of calls, not in re_match_2_internal. I am deleting 100 messages per batch. The point is, such a deletion is quick for a fresh instance of Emacs but slow after that instance of Emacs has been running for several days. In any event, here first is search_buffer then re_match_2_internal 1. Here is the backtrace from a break for search_buffer ( break search.c:1051 ), followed by (gdb) c (gdb) print string (gdb) xstring (gdb) finish #0 search_buffer (string=189937, pos=137573113, pos_byte=137573161, lim=137573113, lim_byte=1, n=1, RE=0, trt=135730036, inverse_trt=-1073747680, posix=188026) at search.c:1051 #1 0x08159be9 in search_command (string=144556139, bound=137573113, noerror=137573161, count=188026, direction=1, RE=1, posix=0) at search.c:939 #2 0x0815c1fe in Fre_search_forward (regexp=188026, bound=188026, noerror=188026, count=188026) at search.c:2160 (gdb) c Continuing. Breakpoint 3, search_buffer (string=189937, pos=137573113, pos_byte=137573161, lim=137573113, lim_byte=1, n=1, RE=0, trt=135730036, inverse_trt=-1073747680, posix=188026) at search.c:1051 (gdb) print string $1 = 189937 (gdb) xstring $2 = (struct Lisp_String *) 0x2e5f0 Cannot access memory at address 0x2e5fc (gdb) finish Run till exit from #0 search_buffer (string=189937, pos=137573113, pos_byte=137573161, lim=137573113, lim_byte=1, n=1, RE=0, trt=135730036, inverse_trt=-1073747680, posix=188026) at search.c:1051 search_command (string=144556139, bound=137573113, noerror=137573161, count=188893, direction=1, RE=1, posix=0) at search.c:947 Value returned is $3 = 188893 (gdb) pp string "\\<\\(ftp://\\|http://\\|gopher://\\|news:\\|nntp:\\|telnet://\\|wais://\\|file:/\\|prospero:\\|z39.50s:\\|z39.50r:\\|cid:\\|mid:\\|vemmi:\\|service:\\|imap:\\|nfs:\\|acap:\\|rtsp:\\|tip:\\|pop:\\|data:\\|dav:\\|opaquelocktoken:\\|sip:\\|tel:\\|fax:\\|modem:\\|ldap:\\|https://\\|soap.beep:\\|soap.beeps:\\|urn:\\|go:\\|afs:\\|tn3270:\\|mailserver:\\|snews:\\)[^] \"'()<>[^`{}]*[^] \"'()<>[^`{}.,;]+" (gdb) xbacktrace "re-search-forward" "goto-address-fontify" "goto-address" "run-hooks" "rmail-show-message" "rmail-summary-goto-msg" "rmail-summary-delete-forward" "call-interactively" 2. Then I put in a break for re_match_2_internal (gdb) break regex.c:4828 and continued. Here is the backtrace and the results of (gdb) print string1 (gdb) xstring (gdb) finish The match is to a spam mail that is in the test mbox I am using. #0 re_match_2_internal (bufp=0x83298cc, string1=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size1=0, string2=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\ 201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size2=1911, pos=867, regs=0x414, stop=0) at regex.c:4835 #1 0x08164102 in re_search_2 (bufp=0x83298cc, str1=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size1=0, str2=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\ 201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size2=1911, startpos=872, range=1039, regs=0x8320268, stop=1911) at regex.c:4328 #2 0x0815a3e5 in search_buffer (string=140965112, pos=188893, pos_byte=867, lim=189937, lim_byte=189937, n=1, RE=1, trt=142892020, inverse_trt=142937924, posix=1084985957) at search.c:1138 (gdb) print string1 $4 = (const unsigned char *) 0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"... (gdb) xstring Argument to arithmetic operation not a number or boolean. (gdb) finish Run till exit from #0 re_match_2_internal (bufp=0x83298cc, string1=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size1=0, string2=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\2 77\201\370\201\300\201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size2=1911, pos=867, regs=0x414, stop=0) at regex.c:4835 re_search_2 (bufp=0x83298cc, str1=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\201\273\201\300\201\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size1=0, str2=0x40ab9265 "From: \"\201\274\201\256\201\301\201\370\201\277\201\3549\" \nReply-To: \"\201\261\201\350\201\271\201\316\201\305\201\3029\" \nTo: bob@rattlesnake.com\nSubject: \201\301\201\367\201\300\201\345\201\300\201\316,\201\260\201\370\201\271\201\253\201\277\201\370\201\300\201\273\201\300\20 1\247\201\307\201\321\201\267\201\320\201\300\201\316\201\306\201\367,\201\303\201\326\201\260\201\355\201\300\201\307\201\307\201\375\201\305\201\303 \201\277\201\3710"..., size2=1911, startpos=872, range=1039, regs=0x8320268, stop=1911) at regex.c:4337 Value returned is $5 = -1 What should I do next? -- Robert J. Chassell bob@rattlesnake.com GnuPG Key ID: 004B4AC8 http://www.rattlesnake.com http://www.teak.cc