From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Pixel-based display functions Date: Tue, 10 Feb 2015 17:48:45 +0200 Message-ID: <83d25h938i.fsf@gnu.org> References: <54CE54A3.1020707@gmx.at> <838ughilmo.fsf@gnu.org> <54CE6BD2.8000402@gmx.at> <8361bliin0.fsf@gnu.org> <83386piiby.fsf@gnu.org> <87oap9yoti.fsf@building.gnus.org> <874mqzvnwo.fsf@building.gnus.org> <83h9uzeb4a.fsf@gnu.org> <87bnl7jrr7.fsf@building.gnus.org> <831tm3dt8u.fsf@gnu.org> <87k2zvgj4d.fsf@building.gnus.org> <83siejcahb.fsf@gnu.org> <83sieiar6i.fsf@gnu.org> <83oap5c480.fsf@gnu.org> <87d25lc3xu.fsf@building.gnus.org> <877fvtc2qj.fsf@building.gnus.org> <83wq3s9rmr.fsf@gnu.org> <878ug72064.fsf@building.gnus.org> <838ug79h3x.fsf@gnu.org> <87egpytlrk.fsf@building.gnus.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1423583358 13084 80.91.229.3 (10 Feb 2015 15:49:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Feb 2015 15:49:18 +0000 (UTC) Cc: rudalics@gmx.at, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 10 16:49:09 2015 Return-path: Envelope-to: ged-emacs-devel@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 1YLD3j-00062m-Q6 for ged-emacs-devel@m.gmane.org; Tue, 10 Feb 2015 16:49:07 +0100 Original-Received: from localhost ([::1]:40404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLD3j-0006tO-AQ for ged-emacs-devel@m.gmane.org; Tue, 10 Feb 2015 10:49:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLD3d-0006tG-Kn for emacs-devel@gnu.org; Tue, 10 Feb 2015 10:49:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLD3Z-00005Y-FJ for emacs-devel@gnu.org; Tue, 10 Feb 2015 10:49:01 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:56958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLD3Z-00005O-8X for emacs-devel@gnu.org; Tue, 10 Feb 2015 10:48:57 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NJK00G00BLIR600@a-mtaout23.012.net.il> for emacs-devel@gnu.org; Tue, 10 Feb 2015 17:48:56 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NJK00G1BBXJRQ00@a-mtaout23.012.net.il>; Tue, 10 Feb 2015 17:48:56 +0200 (IST) In-reply-to: <87egpytlrk.fsf@building.gnus.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.175 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:182809 Archived-At: > From: Lars Ingebrigtsen > Cc: rudalics@gmx.at, emacs-devel@gnu.org > Date: Tue, 10 Feb 2015 15:48:15 +1100 > > > I'd be interested to know if this produces a noticeable speed-up. > > I did the measurements with this (over a variable-width text buffer): > > (benchmark-run 5000 (let ((start (point))) (vertical-motion (cons (/ 500 (frame-char-width)) 0) nil 0) (goto-char start))) > > Without the column parameter, and starting from beginning-of-line, it > takes 1s. Starting from the first characters, it takes 0.6s. > > With the column parameter, and starting from beginning-of-line, it takes > 0.2s. So improvement makes it about 3x faster than the previous > best-case scenario, and 5x faster than the worst-case scenario (in this > simple test). :-) Thanks, these speed-ups match my expectations, given the amount of code I bypass when this new argument is provided. > The major single component that takes time when figuring out > multi-column layouts now is the calls to > > (save-window-excursion > (set-window-buffer nil (current-buffer)) > (window-text-pixel-size ...)) > > If something could be done to make it faster to find out the (maximum) > pixel width of a (possibly undisplayed) buffer, that would be a great > win, I think. Well, you insert those lines into the buffer yourself, right? Can you find the longest line while you are at it, and insert only it? AFAICS, that's the only way of making window-text-pixel-size do its job faster: by making the region FROM..TO it needs to traverse smaller.