From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.bugs Subject: bug#15808: 24.3; thing-at-point slow for url and email Date: Wed, 06 Nov 2013 11:35:39 +0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1383708978 11416 80.91.229.3 (6 Nov 2013 03:36:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Nov 2013 03:36:18 +0000 (UTC) Cc: 15808@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 06 04:36:21 2013 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 1Vdtum-0005Ph-PF for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Nov 2013 04:36:21 +0100 Original-Received: from localhost ([::1]:59694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vdtum-0007BA-Aq for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Nov 2013 22:36:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vdtub-00078v-K7 for bug-gnu-emacs@gnu.org; Tue, 05 Nov 2013 22:36:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdtuU-0001Om-A4 for bug-gnu-emacs@gnu.org; Tue, 05 Nov 2013 22:36:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdtuU-0001Oi-4R for bug-gnu-emacs@gnu.org; Tue, 05 Nov 2013 22:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VdtuT-0006vJ-Jl for bug-gnu-emacs@gnu.org; Tue, 05 Nov 2013 22:36:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Nov 2013 03:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15808 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15808-submit@debbugs.gnu.org id=B15808.138370895326596 (code B ref 15808); Wed, 06 Nov 2013 03:36:01 +0000 Original-Received: (at 15808) by debbugs.gnu.org; 6 Nov 2013 03:35:53 +0000 Original-Received: from localhost ([127.0.0.1]:36437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdtuK-0006us-KJ for submit@debbugs.gnu.org; Tue, 05 Nov 2013 22:35:52 -0500 Original-Received: from mail-pd0-f170.google.com ([209.85.192.170]:37062) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VdtuJ-0006ue-2H for 15808@debbugs.gnu.org; Tue, 05 Nov 2013 22:35:51 -0500 Original-Received: by mail-pd0-f170.google.com with SMTP id v10so9685937pde.1 for <15808@debbugs.gnu.org>; Tue, 05 Nov 2013 19:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=K6N7uksfcTshKOAbQyPZzdpb3AHl35/TMvb09WgLXgY=; b=a41ReONEtpy3J9kBdn/sQ68xGchmnf3TvsFgmg9G20duT9hLDpMUU8j9eawLAn8EA6 5ZR7QIPdgTwla89gpnGOta6pTRLOdY7GyQ8NqMbOXb9xphR65dpRE069sTMe5j3srYLU 6LJpnLk48lMKuwEpQre5aVopVtNUaQ2yI6LnkE5O/PIK+43w80snbv+1FJ2x4KRL4UtF luSUg4yU0wox3+paPxbggBfHUWPFpfghEx7wZau5EMFKUG32arZ/yRrZvPmjIIU65ZOU 0kVdmOMX6wd6MZhZ58lO9ENMAjJJ8EKgErKhF+60PjH1TS5KqQkoPfrzaaYzoosP+GZ1 kr/g== X-Received: by 10.66.7.163 with SMTP id k3mr1688569paa.11.1383708944699; Tue, 05 Nov 2013 19:35:44 -0800 (PST) Original-Received: from localhost ([221.217.232.4]) by mx.google.com with ESMTPSA id pl1sm37944870pbb.20.2013.11.05.19.35.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Nov 2013 19:35:44 -0800 (PST) Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC In-Reply-To: (Stefan Monnier's message of "Tue, 05 Nov 2013 21:18:52 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.9) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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:80056 Archived-At: On 2013-11-06 10:18 +0800, Stefan Monnier wrote: > The count is too small: this is a sample-based profiler, so you need > a long enough runtime to get meaningful results (otherwise, the various > stack fragments collected can't be pieced together to get the whole tree). > > Also, it seems some of the code is interpreted. If the result is still > hard to interpret, you might want to try and byte-compile that code. I tried the thingatpt.el and the URL case is not slow there but email is. Profiler says most time is spent in thing-at-point-looking-at. I propose the following fix? Comments? === modified file 'lisp/thingatpt.el' --- lisp/thingatpt.el 2013-08-10 15:17:29 +0000 +++ lisp/thingatpt.el 2013-11-06 03:32:52 +0000 @@ -476,7 +476,7 @@ ;; matches that straddle the start position so we search forwards once ;; and then back repeatedly and then back up a char at a time. -(defun thing-at-point-looking-at (regexp) +(defun thing-at-point-looking-at (regexp &optional limit) "Return non-nil if point is in or just after a match for REGEXP. Set the match data from the earliest such match ending at or after point." @@ -487,7 +487,7 @@ (setq match (point))) ;; Search back repeatedly from end of next match. ;; This may fail if next match ends before this match does. - (re-search-forward regexp nil 'limit) + (re-search-forward regexp limit 'limit) (while (and (re-search-backward regexp nil t) (or (> (match-beginning 0) old-point) (and (looking-at regexp) ; Extend match-end past search start @@ -518,7 +518,8 @@ (put 'email 'bounds-of-thing-at-point (lambda () - (let ((thing (thing-at-point-looking-at thing-at-point-email-regexp))) + (let ((thing (thing-at-point-looking-at thing-at-point-email-regexp + (+ (point) 500)))) (if thing (let ((beginning (match-beginning 0)) (end (match-end 0)))