From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#18522: 24.4.50; mapcar is very slow Date: Fri, 26 Feb 2016 13:43:44 +1030 Message-ID: <87egc0noyf.fsf@gnus.org> References: <8738bkdjqg.fsf@micropit.roche-blanche.homenet.org> <878u2eun9o.fsf@roche-blanche.net> <834md2niqt.fsf@gnu.org> <87k2lyszy2.fsf@roche-blanche.net> <83bn79n66p.fsf@gnu.org> <87vb5hry9y.fsf@roche-blanche.net> <83r3g4lnor.fsf@gnu.org> <87r3g4o4uw.fsf@roche-blanche.net> <83h9h0jwfo.fsf@gnu.org> <87mvqru119.fsf@roche-blanche.net> <8360xfjsyr.fsf@gnu.org> <878u2bs7tl.fsf@roche-blanche.net> <83r3g3iajr.fsf@gnu.org> <87twkypfqx.fsf@roche-blanche.net> <83vb5egg8y.fsf@gnu.org> <87fuwikmzc.fsf@roche-blanche.net> <83io1ege6r.fsf@gnu.org> <87y4a9kh9e.fsf@roche-blanche.net> <87vb5dvf6c.fsf@gnus.org> <8760xdi54j.fsf@roche-blanche.net> <83vb5cg4r6.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1456456525 27960 80.91.229.3 (26 Feb 2016 03:15:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Feb 2016 03:15:25 +0000 (UTC) Cc: Peter =?UTF-8?Q?M=C3=BCnster?= , 18522@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 26 04:15:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aZ8s3-0007ir-Uc for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 04:15:12 +0100 Original-Received: from localhost ([::1]:47021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ8s3-0001Dm-3Q for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Feb 2016 22:15:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ8rx-00018r-J6 for bug-gnu-emacs@gnu.org; Thu, 25 Feb 2016 22:15:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZ8ru-0007Z9-DA for bug-gnu-emacs@gnu.org; Thu, 25 Feb 2016 22:15:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ8ru-0007Z5-8b for bug-gnu-emacs@gnu.org; Thu, 25 Feb 2016 22:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aZ8rt-0007Ig-Qt; Thu, 25 Feb 2016 22:15:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Fri, 26 Feb 2016 03:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18522 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: Original-Received: via spool by 18522-submit@debbugs.gnu.org id=B18522.145645645727999 (code B ref 18522); Fri, 26 Feb 2016 03:15:01 +0000 Original-Received: (at 18522) by debbugs.gnu.org; 26 Feb 2016 03:14:17 +0000 Original-Received: from localhost ([127.0.0.1]:46553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZ8rB-0007HW-1I for submit@debbugs.gnu.org; Thu, 25 Feb 2016 22:14:17 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:58869) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZ8r9-0007HO-H6 for 18522@debbugs.gnu.org; Thu, 25 Feb 2016 22:14:15 -0500 Original-Received: from [175.103.25.178] (helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aZ8qj-0001PG-G9; Fri, 26 Feb 2016 04:13:50 +0100 In-Reply-To: <83vb5cg4r6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 25 Feb 2016 17:59:41 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aZ8qj-0001PG-G9 MailScanner-NULL-Check: 1457061231.86257@nzy6Q+CqRARZHJJVWQEOVg X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113829 Archived-At: Eli Zaretskii writes: > . most of the buffers over which set-default loops were actually > killed, but they are still in all_buffers list which set-default > traverses, although they were supposed to be removed by GC > . killed buffers are not removed from all_buffers by GC because > they are referenced by gnus-buffers > . gnus-buffers references killed buffers because Peter kills buffers > behind Gnus back, instead of letting them be killed through > gnus-kill-buffer, which would have removed them from gnus-buffers It's probably not just Peter, but... code somewhere. My gnus-buffers is currently: (# # # # # # # # # # #> # # #>= # # # # # # # # # # # # # # # # #= # # # # # # #) I'll fix the gnus-{add,kill}-buffer functions so that they remove all the killed buffers. That should help keep that list down to a reasonable length, and let all the killed buffers be GC'd. > If the above is an accurate account of what we've discovered, then we > have several factors here that conspire to make Peter's Gnus slow: > > . parse-time-string should try to avoid binding case-fold-search > globally, or at all It's kinda weird. This starts with: (defun parse-time-string (string) [...] (temp (parse-time-tokenize (downcase string)))) which calls (defsubst parse-time-string-chars (char) (save-match-data (let (case-fold-search str) (cond ((eq char ?+) 1) ((eq char ?-) -1) ((eq char ?:) ?d) ((string-match "[[:upper:]]" (setq str (string char))) ?A) ((string-match "[[:lower:]]" str) ?a) ((string-match "[[:digit:]]" str) ?0))))) !? Since we've already downcased the entire string, both the `case-fold-search' and the match to [[:upper:]] seem rather nonsensical? So that should be fixed, but: > . set-default should skip killed buffers Yes. I think that would be a win in general. > For the second issue, I propose to modify set-default to use > FOR_EACH_LIVE_BUFFER instead of FOR_EACH_BUFFER. Does anyone see a > problem with that? Hm... If a buffer is killed, do the local variables still have an effect? I'm thinking of code like: (with-temp-buffer (setq-local foo 'bar) (kill-buffer (current-buffer)) (let ((buf (current-buffer))) (with-temp-buffer (let ((foo 'zot)) (set-buffer buf) foo)))) Well, that answered itself. :-) It returns zot. (If we don't kill it returns bar.) So I don't see any reason not to use FOR_EACH_LIVE_BUFFER here. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no