From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: State of the overlay tree branch? Date: Thu, 22 Mar 2018 16:52:14 -0400 Message-ID: References: <834lldp18f.fsf@gnu.org> <9646341d-700b-4240-216b-8c0e753fa79f@arkona-technologies.de> <86d03e78-9984-f33e-a3f3-3faa4b34d78b@arkona-technologies.de> <83vadso9ad.fsf@gnu.org> <5155d5e2-6b5c-581e-89fe-4f3af717304f@arkona-technologies.de> <4c82fcbd-961a-c6ca-b1f0-6b85665cb339@arkona-technologies.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1521751841 21136 195.159.176.226 (22 Mar 2018 20:50:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 22 Mar 2018 20:50:41 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 22 21:50:37 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ez7AO-0005Im-Fm for ged-emacs-devel@m.gmane.org; Thu, 22 Mar 2018 21:50:32 +0100 Original-Received: from localhost ([::1]:34843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ez7CR-0007GB-OT for ged-emacs-devel@m.gmane.org; Thu, 22 Mar 2018 16:52:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ez7CJ-0007Fp-2N for emacs-devel@gnu.org; Thu, 22 Mar 2018 16:52:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ez7CE-000692-6v for emacs-devel@gnu.org; Thu, 22 Mar 2018 16:52:31 -0400 Original-Received: from [195.159.176.226] (port=35715 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ez7CE-00066W-0O for emacs-devel@gnu.org; Thu, 22 Mar 2018 16:52:26 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ez7A8-0004zl-3f for emacs-devel@gnu.org; Thu, 22 Mar 2018 21:50:16 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 90 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:UyB2MI+qqo5447ck2oJLOOlnAGw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:223926 Archived-At: > (defun benchmark-often () > (cl-loop for n from 1 upto 20 do > (message (format "iteration %d: %f" n (nth 0 (benchmark-run > (line-number-at-pos (point)))))))) ^^^^^^^ Where is this "point" in your tests (I expect the timing to vary significantly depending on this). > 1st run: > iteration 1: 0.001213 > iteration 2: 0.001170 > iteration 3: 0.001170 > iteration 4: 0.001238 > iteration 5: 0.001163 > iteration 6: 0.001153 > iteration 7: 0.000421 > iteration 8: 0.000426 > iteration 9: 0.000322 > iteration 10: 0.000301 > iteration 11: 0.000291 > iteration 12: 0.000292 > iteration 13: 0.000291 > iteration 14: 0.000291 > iteration 15: 0.000295 > iteration 16: 0.000289 > iteration 17: 0.000289 > iteration 18: 0.000288 > iteration 19: 0.000288 > iteration 20: 0.000287 I recommend you don't bother outputting all 20 results: better summarize it by getting rid of the first test and then giving e.g. the sum or the median of the rest. > I'm not allowed to share my employer's source code as a test case, so > I tried the same procedure with the similarly large DeclBase.h from the > public LLVM repository. To my surprise, DeclBase.h didn't suffer from any > performance issues at all. My crystal ball tells me that DeclBase.h is pure ASCII so byte<->char conversion is trivial, whereas your file likely contains umlauts and other disreputable characters. Here's a similar test case to yours but which builds up its own artificial buffer with a few non-ascii chars to spice things up: (with-temp-buffer (dotimes (i 1000) (insert "lksajflahalskjdféefawrgfrüegf\n")) (let ((txtbuf (current-buffer))) (dotimes (s 4) (with-temp-buffer (insert-buffer-substring txtbuf) (let ((stepsize (lsh 10 (* 4 s)))) (cl-loop for n from (point-min) upto (- (point-max) stepsize) by stepsize do (let ((ov (make-overlay n (+ (1- stepsize) n)))) (overlay-put ov 'cquery-sem-highlight t)))) (dotimes (i 4) (let ((timing (benchmark-run 1000 (line-number-at-pos (+ (point-min) (* i (/ (buffer-size) 4))))))) (message "ols=%S pos=%S/4 time=%.4f (+ %S)" (/ (buffer-size) (lsh 10 (* 4 s))) i (car timing) (cdr timing))) ))))) This gave me (on my top-of-the-line Thinkpad T61 using Debian's `emacs25`): ols=3000 pos=0/4 time=0.0018 (+ (0 0.0)) ols=3000 pos=1/4 time=6.1074 (+ (0 0.0)) ols=3000 pos=2/4 time=10.6876 (+ (0 0.0)) ols=3000 pos=3/4 time=13.7854 (+ (0 0.0)) ols=187 pos=0/4 time=0.0016 (+ (0 0.0)) ols=187 pos=1/4 time=0.3055 (+ (0 0.0)) ols=187 pos=2/4 time=0.6001 (+ (0 0.0)) ols=187 pos=3/4 time=0.8903 (+ (0 0.0)) ols=11 pos=0/4 time=0.0015 (+ (0 0.0)) ols=11 pos=1/4 time=0.0769 (+ (1 0.006324223)) ols=11 pos=2/4 time=0.1439 (+ (0 0.0)) ols=11 pos=3/4 time=0.2215 (+ (0 0.0)) ols=0 pos=0/4 time=0.0015 (+ (0 0.0)) ols=0 pos=1/4 time=0.0548 (+ (0 0.0)) ols=0 pos=2/4 time=0.1102 (+ (0 0.0)) ols=0 pos=3/4 time=0.1690 (+ (0 0.0)) Stefan