From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Unbearably slow editing in .h files Date: Thu, 3 Apr 2008 17:58:42 +0000 Message-ID: <20080403175842.GA1146@muc.de> References: <47B9E0B1.1090908@gmx.at> <20080223224901.GB3476@muc.de> <47C0A376.8080105@gmx.at> <20080402220710.GC1283@muc.de> <200804022347.m32NlqS5010556@sallyv1.ics.uci.edu> <20080403091400.GA1937@muc.de> <200804031310.m33DAfB3009774@sallyv1.ics.uci.edu> <20080403141703.GB1937@muc.de> <200804031522.m33FMAEI002427@sallyv1.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1207244588 29999 80.91.229.12 (3 Apr 2008 17:43:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Apr 2008 17:43:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 03 19:43:40 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JhTTQ-0008La-Bg for ged-emacs-devel@m.gmane.org; Thu, 03 Apr 2008 19:43:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhTSn-00087w-Tt for ged-emacs-devel@m.gmane.org; Thu, 03 Apr 2008 13:43:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JhTSi-00086U-S1 for emacs-devel@gnu.org; Thu, 03 Apr 2008 13:42:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JhTSh-00085d-VJ for emacs-devel@gnu.org; Thu, 03 Apr 2008 13:42:56 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhTSh-00085Y-S2 for emacs-devel@gnu.org; Thu, 03 Apr 2008 13:42:55 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JhTSh-0000Md-BO for emacs-devel@gnu.org; Thu, 03 Apr 2008 13:42:55 -0400 Original-Received: (qmail 56495 invoked by uid 3782); 3 Apr 2008 17:42:42 -0000 Original-Received: from acm.muc.de (p57AF7592.dip.t-dialin.net [87.175.117.146]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Thu, 03 Apr 2008 19:42:40 +0200 Original-Received: (qmail 1828 invoked by uid 1000); 3 Apr 2008 17:58:42 -0000 Content-Disposition: inline In-Reply-To: <200804031522.m33FMAEI002427@sallyv1.ics.uci.edu> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:94277 Archived-At: Hi, again! On Thu, Apr 03, 2008 at 08:22:10AM -0700, Dan Nicolaescu wrote: > Alan Mackenzie writes: > > On Thu, Apr 03, 2008 at 06:10:40AM -0700, Dan Nicolaescu wrote: > > > Alan Mackenzie writes: > > > > On Wed, Apr 02, 2008 at 04:47:52PM -0700, Dan Nicolaescu wrote: > > > Note that `diff-add-change-log-entries-other-window' is C-x 4 A not > > > C-x 4 a, it is the equivalent of: > > > FOR each hunk in a diff DO > > > C-x 4 a > > Wow! I've just tried this. It's amazing! There are one or two > > things in it which aren't quite right, though. > Yep, it should not generate duplicate entries. One possible > improvement is that it should iterate at a lower granularity than a > hunk, some hunks have changes ! + and - changes. (but that's still not > enough, a + hunk could be adding 5 functions...) I tried it (with a window configuration I can't remember exactly) and ChangeLog ended up in both the upper and lower windows. But that's for another thread. ;-) > > > When used on a diff buffer with thousands of lines, it is a bit > > > slow. > > Hmmm. I've only tried it on diffs with elisp files. That was a > > little slow. Do you mean it's _very_ slow with C file diffs? Can > > you give some numbers here? Processor speed, size of diff file, > > time it takes. > Unfortunately I don't have any massive patches handy, so I can't test > now how much things have improved for exactly the things that had > problems before. But some quick tests with the diff for lisp.h > revision 1.606 (i.e. something that had a long ChangeLog entry, 625 > lines unidiff) showed that things have improved quite a lot today vs a > > 1 month old emacs (a few seconds vs > 2 minutes). Which is great. > Thanks! :-) > Trying C-x 4 A on a 4-5000 lines patch would be more interesting... Yes. > > But then again, people are only going to be using it once or twice > > per patch (and then having to fill out the result by hand), so it > > is surely not that critical. But if it were taking 20 minutes > > rather than 45 seconds, that would be too slow, I agree. > Ideally in the future C-x 4 A should be done automatically when doing a > checkin, that why it is important to be as fast as possible. I'm not sure I agree, here. That might make it far too easy for people to forget (or even to "forget") to write commit comments. > > > > To the extent that it's still slower than it might be, yes > > > > it's the K&R stuff making it slow. The function which takes > > > > time is c-in-knr-argdecl (cc-engine.el, ~L6317). Actually, > > > > this function gets called twice. It would take a lot of > > > > refactoring to make it get called only once. > > > What if it's not called at all? After all, the vast majority of > > > the users never edit K&R. Just a thought... > > Well, one set of users who still use K&R is the Emacs development > > team. ;-) > Yeah, and many people wish that would change at some point. But that a > separate discussion that we should get into now. I'm not sure why we don't just change all the K&R declarations to ANSI ones. It could probably be done simply enough with a script (awk, perl, python, Emacs Lisp, or anything else). > > It would be possible, and very easy, to make K&R a user option. > > But I don't think that's the right thing to do. > > The overhead that K&R imposes on C-M-a and C-x 4 a is not _that_ > > high, and it will diminish as processors continue to get faster. I > > recently put in a hard-coded limit to the number of parameter > > declarations in a K&R section. That limit is currently 20. > Just exploring options here... > Would simply ignoring K&R for the purpose of running C-x 4 a work? No. You're at the opening brace of a C function/typedef/struct; you've got, somehow, to get from there to the function name. That involves jumping backwards over the K&R region, should it be present. Or, point starts out _outside_ a brace block. You've got to decide whether it's inside a function/typedef/struct header, and this might be the K&R region. > Yes, it might generate the wrong name in the ChangeLog entry in some > very limited cases (is that true?), ..... I doubt it. I think it would foul up with _every_ K&R function declaration. To try it out, set the major mode to C++ mode, then try C-M-a or C-x 4 a. In fact, in xdisp.c, I've just done this, gone to EOB and typed C-M-a 25 times. It got BOD OK 8 times, failed 17 times. > ...., but that's not very critical. I think it would be. It would only need to happen to a hacker once, and he would lose all confidence in it. He would then feel obliged to check every entry by hand - and the complaints would find their way to bug-cc-mode@gnu.org. ;-( -- Alan Mackenzie (Nuremberg, Germany).