From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David De La Harpe Golden Newsgroups: gmane.emacs.devel Subject: Re: Strange slowness when killing words interactively Date: Mon, 09 May 2011 02:18:00 +0100 Message-ID: <4DC740C8.2050000@harpegolden.net> References: <87pqo1oqg2.fsf@stupidchicken.com> <4DBEDCA6.1030600@harpegolden.net> <4DBF84CC.60605@harpegolden.net> <871v0g74g8.fsf@uwakimon.sk.tsukuba.ac.jp> <4DC0E5FB.5040905@harpegolden.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000402080308090501010801" X-Trace: dough.gmane.org 1304903902 6507 80.91.229.12 (9 May 2011 01:18:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 9 May 2011 01:18:22 +0000 (UTC) Cc: Emacs developers To: Taylor Venable Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 09 03:18:11 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QJF6w-0005mh-LE for ged-emacs-devel@m.gmane.org; Mon, 09 May 2011 03:18:11 +0200 Original-Received: from localhost ([::1]:56845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJF6v-0003di-U4 for ged-emacs-devel@m.gmane.org; Sun, 08 May 2011 21:18:09 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJF6s-0003dR-I0 for emacs-devel@gnu.org; Sun, 08 May 2011 21:18:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJF6q-0003lY-92 for emacs-devel@gnu.org; Sun, 08 May 2011 21:18:06 -0400 Original-Received: from harpegolden.net ([65.99.215.13]:53577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJF6p-0003lS-Ut for emacs-devel@gnu.org; Sun, 08 May 2011 21:18:04 -0400 Original-Received: from [87.198.47.20] (87-198-47-20.ptr.magnet.ie [87.198.47.20]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 315B8683CB; Mon, 9 May 2011 02:18:02 +0100 (IST) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110402 Icedove/3.1.9 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 65.99.215.13 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139236 Archived-At: This is a multi-part message in MIME format. --------------000402080308090501010801 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 07/05/11 03:52, Taylor Venable wrote: > > XFCE 4.8.0 > > That appears to be the case here, the sort-of hidden clipboard manager > in XFCE, because there do not appear to be any separate processes > running that are related to clipboard management. Now running XFCE 4.8.0 from debian unstable here. So much for "shouldn't be problematic". xfce4-settings-helper's embedded clipboard manager is indeed eagerly making a copy on every change. At least it's not eagerly nabbing clipboard ownership, like something from the motifozoic. But it seems to convert nearly every target every time. o_O (See attached emacs_xfce_clipboard_1.log, jut killing the word "This" and then "buffer" from *scratch* with two consecutive M-d presses). ** As an immediate workaround, you could pause (kill -STOP/-CONT) or kill outright the problem xfce4-settings-helper daemon when using emacs, though that's hardly a good solution. And it looks like it is somewhat eagerly doing it for primary too - though it seems to only go after UTF8_STRING in that case, and may have some band-aid idle timer. (See attached emacs_xfce_primary_1.log, just a C-SPC and then sedately moving right to select the word "notes" in *scratch*) (The spec is currently silent on primary - although it seems very reasonable to me to expect a PRIMARY_MANAGER and even SECONDARY_MANAGER by the obvious analogy with CLIPBOARD_MANAGER, that doesn't seem to be actually written down anywhere, nor implemented) For emacs' part, it is doing the right thing by reacquiring on each change.[1] Though emacs needs to do more to comply fully with the spec, I suspect it won't help - Still, it might be worth checking to see if XFCE stops its nasty behaviour if emacs is patched to support (or claim to support) SAVE_TARGETS, just in case XFCE is only doing it for spec-unaware clients as previously speculated about (actually, XFCE has sources available, I suppose I could just go look). ** But after checking that, really only remains raising a bug report for XFCE. This won't really be affecting emacs only, it's just relatively noticeable in the emacs case. The GNOME one is not actually completely free of overhead, but it's much more minor. gnome-settings-daemon from GNOME 2.30 on my system is repeatedly asking emacs for TARGETS (perhaps it's worried about the metadata change as per [1] even if it knows better than to grab the entire clipboard content each change), but that is a small constant overhead, not a problem compared to the large increasing overheard xfce4-settings-helper can generate, certainly low enough that I didn't notice until just now when I logged it. (see attached emacs_gnome_clipboard_1.log, killing "This" and then "buffer" from *scratch* with two consecutive M-d presses). So I guess XFCE's xfce4-settings-helper implementation was not actually based on GNOME's example and there was some slight misunderstanding on the XFCE side. Though I suppose they could have made a deliberate decision to work that way, so that even spec-unaware clients' clipboards (and primaries) got persisted after exit as previously discussed, even if it's at IMO rather too high a price. But if that's so, maybe they would still be willing to at least not do it for obviously spec-aware clients (if they're not already not doing it in that case, as above I haven't checked yet), and then, um, we'd just have to modify emacs to comply with the client-side of the spec, which would be a good thing anyway. Of course under either desktop environment, if you instead run a full history-keeping clipboard manager, it will end up eagerly making copies, but that's a tradeoff a user usually chooses to make by running such a thing. (I have some vague ideas for making them more efficient, but that would have to wait until I have a /lot/ of free time...) [1] http://www.freedesktop.org/wiki/ClipboardManager """clipboard owners should reacquire the clipboard whenever the content or metadata (e.g the list of supported targets) changes.""" --------------000402080308090501010801 Content-Type: text/x-log; name="emacs_xfce_clipboard_1.log" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="emacs_xfce_clipboard_1.log" 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728809 8577: XInternAtom LENGTH 8577: XInternAtom FILE_NAME 8577: XInternAtom CHARACTER_POSITION 8577: XInternAtom LINE_NUMBER 8577: XInternAtom COLUMN_NUMBER 8577: XInternAtom OWNER_OS 8577: XInternAtom HOST_NAME 8577: XInternAtom USER 8577: XInternAtom CLASS 8577: XInternAtom NAME 8577: CLIPBOARD, target TARGETS (1) 8577: Sending all 76 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728828 8577: CLIPBOARD, target TIMESTAMP (2) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728831 8577: CLIPBOARD, target TEXT (3) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728832 8577: CLIPBOARD, target COMPOUND_TEXT (4) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728833 8577: CLIPBOARD, target STRING (5) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728835 8577: CLIPBOARD, target UTF8_STRING (6) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728836 8577: XGetAtomName --> LENGTH 8577: CLIPBOARD, target LENGTH (7) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728837 8577: XGetAtomName --> FILE_NAME 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728838 8577: XGetAtomName --> CHARACTER_POSITION 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728840 8577: XGetAtomName --> LINE_NUMBER 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728841 8577: XGetAtomName --> COLUMN_NUMBER 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728842 8577: XGetAtomName --> OWNER_OS 8577: CLIPBOARD, target OWNER_OS (8) 8577: Sending all 9 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728843 8577: XGetAtomName --> HOST_NAME 8577: CLIPBOARD, target HOST_NAME (9) 8577: Sending all 23 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728845 8577: XGetAtomName --> USER 8577: CLIPBOARD, target USER (10) 8577: Sending all 24 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728846 8577: XGetAtomName --> CLASS 8577: CLIPBOARD, target CLASS (11) 8577: Sending all 5 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728847 8577: XGetAtomName --> NAME 8577: CLIPBOARD, target NAME (12) 8577: Sending all 5 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728849 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30728850 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729910 8577: XInternAtom LENGTH 8577: XInternAtom FILE_NAME 8577: XInternAtom CHARACTER_POSITION 8577: XInternAtom LINE_NUMBER 8577: XInternAtom COLUMN_NUMBER 8577: XInternAtom OWNER_OS 8577: XInternAtom HOST_NAME 8577: XInternAtom USER 8577: XInternAtom CLASS 8577: XInternAtom NAME 8577: CLIPBOARD, target TARGETS (13) 8577: Sending all 76 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729913 8577: CLIPBOARD, target TIMESTAMP (14) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729914 8577: CLIPBOARD, target TEXT (15) 8577: Sending all 11 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729914 8577: CLIPBOARD, target COMPOUND_TEXT (16) 8577: Sending all 11 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729915 8577: CLIPBOARD, target STRING (17) 8577: Sending all 11 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729917 8577: CLIPBOARD, target UTF8_STRING (18) 8577: Sending all 11 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729918 8577: XGetAtomName --> LENGTH 8577: CLIPBOARD, target LENGTH (19) 8577: Sending all 4 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729919 8577: XGetAtomName --> FILE_NAME 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729920 8577: XGetAtomName --> CHARACTER_POSITION 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729922 8577: XGetAtomName --> LINE_NUMBER 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729923 8577: XGetAtomName --> COLUMN_NUMBER 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729924 8577: XGetAtomName --> OWNER_OS 8577: CLIPBOARD, target OWNER_OS (20) 8577: Sending all 9 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729925 8577: XGetAtomName --> HOST_NAME 8577: CLIPBOARD, target HOST_NAME (21) 8577: Sending all 23 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729927 8577: XGetAtomName --> USER 8577: CLIPBOARD, target USER (22) 8577: Sending all 24 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729928 8577: XGetAtomName --> CLASS 8577: CLIPBOARD, target CLASS (23) 8577: Sending all 5 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729929 8577: XGetAtomName --> NAME 8577: CLIPBOARD, target NAME (24) 8577: Sending all 5 bytes 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729930 8577: x_handle_selection_event 8577: x_handle_selection_request, from=0x01c0001f time=30729932 --------------000402080308090501010801 Content-Type: text/x-log; name="emacs_xfce_primary_1.log" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="emacs_xfce_primary_1.log" 8653: x_handle_selection_event 8653: x_handle_selection_request, from=0x01c0001f time=31171410 8653: PRIMARY, target UTF8_STRING (1) 8653: Sending all 1 bytes 8653: x_handle_selection_event 8653: x_handle_selection_request, from=0x01c0001f time=31172636 8653: PRIMARY, target UTF8_STRING (2) 8653: Sending all 2 bytes 8653: x_handle_selection_event 8653: x_handle_selection_request, from=0x01c0001f time=31173630 8653: PRIMARY, target UTF8_STRING (3) 8653: Sending all 3 bytes 8653: x_handle_selection_event 8653: x_handle_selection_request, from=0x01c0001f time=31174518 8653: PRIMARY, target UTF8_STRING (4) 8653: Sending all 4 bytes 8653: x_handle_selection_event 8653: x_handle_selection_request, from=0x01c0001f time=31175091 8653: PRIMARY, target UTF8_STRING (5) 8653: Sending all 5 bytes --------------000402080308090501010801 Content-Type: text/x-log; name="emacs_gnome_clipboard_1.log" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="emacs_gnome_clipboard_1.log" 9892: x_handle_selection_event 9892: x_handle_selection_request, from=0x012000bb time=33907182 9892: XInternAtom LENGTH 9892: XInternAtom FILE_NAME 9892: XInternAtom CHARACTER_POSITION 9892: XInternAtom LINE_NUMBER 9892: XInternAtom COLUMN_NUMBER 9892: XInternAtom OWNER_OS 9892: XInternAtom HOST_NAME 9892: XInternAtom USER 9892: XInternAtom CLASS 9892: XInternAtom NAME 9892: CLIPBOARD, target TARGETS (1) 9892: Sending all 76 bytes 9892: x_handle_selection_event 9892: x_handle_selection_request, from=0x012000bb time=33908020 9892: XInternAtom LENGTH 9892: XInternAtom FILE_NAME 9892: XInternAtom CHARACTER_POSITION 9892: XInternAtom LINE_NUMBER 9892: XInternAtom COLUMN_NUMBER 9892: XInternAtom OWNER_OS 9892: XInternAtom HOST_NAME 9892: XInternAtom USER 9892: XInternAtom CLASS 9892: XInternAtom NAME 9892: CLIPBOARD, target TARGETS (2) 9892: Sending all 76 bytes --------------000402080308090501010801 Content-Type: text/x-log; name="emacs_gnome_primary_1.log" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="emacs_gnome_primary_1.log" --------------000402080308090501010801--