From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: Windows: Emacs 23 slow with long lines and raster fonts Resent-From: bogossian@mail.com Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jun 2010 18:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6364@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.127584963628122 (code B ref -1); Sun, 06 Jun 2010 18:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Jun 2010 18:40:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLKlv-0007JX-RF for submit@debbugs.gnu.org; Sun, 06 Jun 2010 14:40:36 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLKlK-0007Ip-7J for submit@debbugs.gnu.org; Sun, 06 Jun 2010 14:39:59 -0400 Received: from lists.gnu.org ([199.232.76.165]:35754) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OLKlE-00047V-C8 for submit@debbugs.gnu.org; Sun, 06 Jun 2010 14:39:52 -0400 Received: from [140.186.70.92] (port=35008 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLKlA-00082Q-M2 for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2010 14:39:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLKl4-0001fX-CQ for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2010 14:39:46 -0400 Received: from imr-da02.mx.aol.com ([205.188.105.144]:43706) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLKl4-0001fS-AC for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2010 14:39:42 -0400 Received: from imo-da03.mx.aol.com (imo-da03.mx.aol.com [205.188.169.201]) by imr-da02.mx.aol.com (8.14.1/8.14.1) with ESMTP id o56IderB030464 for ; Sun, 6 Jun 2010 14:39:40 -0400 Received: from bogossian@mail.com by imo-da03.mx.aol.com (mail_out_v42.9.) id 7.d75.9ae2e33 (34980) for ; Sun, 6 Jun 2010 14:39:36 -0400 (EDT) Received: from smtprly-dc02.mx.aol.com (smtprly-dc02.mx.aol.com [205.188.170.2]) by cia-da08.mx.aol.com (v129.4) with ESMTP id MAILCIADA085-d2f44c0beb67276; Sun, 06 Jun 2010 14:39:36 -0400 Received: from web-mmc-m08 (web-mmc-m08.sim.aol.com [64.12.224.141]) by smtprly-dc02.mx.aol.com (v129.4) with ESMTP id MAILSMTPRLYDC023-d2f44c0beb67276; Sun, 06 Jun 2010 14:39:35 -0400 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Jun 2010 14:39:35 -0400 X-MB-Message-Source: WebUI X-AOL-IP: 82.66.250.190 X-MB-Message-Type: User MIME-Version: 1.0 From: bogossian@mail.com Content-Type: text/plain; charset="us-ascii"; format=flowed X-Mailer: Mail.com Webmail 31888-STANDARD Received: from 82.66.250.190 by web-mmc-m08.sysops.aol.com (64.12.224.141) with HTTP (WebMailUI); Sun, 06 Jun 2010 14:39:35 -0400 Message-Id: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> X-AOL-SENDER: bogossian@mail.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Sun, 06 Jun 2010 14:40:34 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.3 (-----) Hi, the Windows build of Emacs 23 is extremely slow when scrolling in a=20 buffer containing long lines if a bitmap font is used. For example, scrolling though a file made of 200 lines of 1000=20 characters each feels choppy. Doing the same with a file containing very long lines (like tens of=20 thousand characters) can make Emacs hang for seconds or minutes, making it=20 practically unusable. Editing files with such long lines is not absurd, various types of=20 computer generated files (log files, export files, dumps, ...) can have very very long lines. These bad performances are a regression, Emacs 21 and Emcas 22 were much faster in the same conditions. To illustrate this regression, and to show it's related to the use of=20 bitmap fonts, I've made this very simple and easy to reproduce benchmark: I built an 8MB file containing a single line (the content of the file doesn't matter). I opened the file in emacs, and then I hit "ESC >" to=20 reach the end of the buffer. I measured the time it takes for emacs to refresh from the moment I typed the macro. (Test setup: Athlon XP 2GHz, Windows XP SP3) If Emacs is started with the command line "emacs -q", here are the=20 results: Emacs 21.3.1: 8s Emacs 22.3.1: 14s Emacs 23.2.1: 63s (uniscribe backend) Emacs 23 can be made a little faster by forcing the gdi rendering=20 backend with the command line "emacs -q -xrm Emacs.FontBackend:gdi": Emacs 23.2.1: 38s (gdi backend) Now, if I repeat the same test using the command "emacs -q -fn=20 Courier", to use a bitmap font, things are getting really bad for Emacs 23: Emacs 21.3.1: 8s (raster font) Emacs 22.3.1: 14s (raster font) Emacs 23.2.1: 515s (raster font, gdi backend) Regards, Pierre PS: this issue has been discussed on the emacs-devel mailing list: http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00478.html From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> In-Reply-To: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> Resent-From: Tom Seddon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 00:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6364@debbugs.gnu.org Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.138542654625685 (code B ref 6364); Tue, 26 Nov 2013 00:43:01 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 00:42:26 +0000 Received: from localhost ([127.0.0.1]:45161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl6jR-0006gB-Aq for submit@debbugs.gnu.org; Mon, 25 Nov 2013 19:42:25 -0500 Received: from caiajhbdcbef.dreamhost.com ([208.97.132.145]:35339 helo=homiemail-a96.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl6cR-0006Vh-Dn for 6364@debbugs.gnu.org; Mon, 25 Nov 2013 19:35:12 -0500 Received: from homiemail-a96.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a96.g.dreamhost.com (Postfix) with ESMTP id 43B4E3B806C for <6364@debbugs.gnu.org>; Mon, 25 Nov 2013 16:35:10 -0800 (PST) Received: from [192.168.1.101] (tomseddon.plus.com [212.159.116.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: tom@ouro.ltd.uk) by homiemail-a96.g.dreamhost.com (Postfix) with ESMTPSA id 582953B8005 for <6364@debbugs.gnu.org>; Mon, 25 Nov 2013 16:35:08 -0800 (PST) From: Tom Seddon Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> Date: Tue, 26 Nov 2013 00:35:05 +0000 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) X-Mailer: Apple Mail (2.1822) X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Mon, 25 Nov 2013 19:42:23 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Please find below a patch to improve the poor scrolling performance when = using bitmap fonts. #14721 = (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14721) and and 14307 = (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14307) may also be = affected. The patch has been tested against emacs 24.3. It applied = cleanly to git head (22687e54e0e4d7c73c098417478574a55393fe2c) but I = haven't built it. Performance with particularly long lines is still rather poor, but = general responsiveness is much improved. (Once the buffer is fontified, = emacs can now usually keep up if I hold down PgUp, PgDn, C-s, etc.) (I settled on GetCharABCWidthsFloatW because it works for bitmap fonts = and TrueType fonts alike. But the key thing is simply not to create a DC = each time w32font_text_extents is called, so there are various other = functions that could be called instead if preferred.) --Tom =46rom ccedd16f6bd2027145b9e172346d2c3b31c811df Mon Sep 17 00:00:00 2001 From: Tom Seddon Date: Mon, 25 Nov 2013 22:19:47 +0000 Subject: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. The previous fallback - which will still be used if GetCharABCWidthsFloatW fails - was to call GetTextExtentPoint32W. This can be rather slow due to having to create a DC for it each time. --- src/w32font.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/w32font.c b/src/w32font.c index 5c5a15c..3577dfa 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -149,6 +149,7 @@ static BOOL g_b_init_get_outline_metrics_w; static BOOL g_b_init_get_text_metrics_w; static BOOL g_b_init_get_glyph_outline_w; static BOOL g_b_init_get_glyph_outline_w; +static BOOL g_b_init_get_char_abc_widths_float_w; =20 typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) ( HDC hdc, @@ -165,6 +166,11 @@ typedef DWORD (WINAPI * GetGlyphOutlineW_Proc) ( DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2); +typedef BOOL (WINAPI * GetCharABCWidthsFloatW_Proc) ( + HDC hdc, + UINT uFirstChar, + UINT uLastChar, + LPABCFLOAT lpabc); =20 /* Several "wide" functions we use to support the font backends are unavailable on Windows 9X, unless UNICOWS.DLL is installed (their @@ -274,6 +280,23 @@ get_glyph_outline_w (HDC hdc, UINT uChar, UINT = uFormat, LPGLYPHMETRICS lpgm, lpvBuffer, lpmat2); } =20 +static DWORD WINAPI get_char_abc_widths_float_w (HDC hdc, UINT = uFirstChar, + UINT uLastChar, = LPABCFLOAT lpabc) +{ + static GetCharABCWidthsFloatW_Proc s_pfn_Get_Char_ABC_Widths_FloatW =3D= NULL; + HMODULE hm_unicows =3D NULL; + if (g_b_init_get_char_abc_widths_float_w =3D=3D 0) + { + g_b_init_get_char_abc_widths_float_w =3D 1; + hm_unicows =3D w32_load_unicows_or_gdi32 (); + if (hm_unicows) + s_pfn_Get_Char_ABC_Widths_FloatW =3D = (GetCharABCWidthsFloatW_Proc) + GetProcAddress (hm_unicows, "GetCharABCWidthsFloatW"); + } + eassert (s_pfn_Get_Char_ABC_Widths_FloatW !=3D NULL); + return s_pfn_Get_Char_ABC_Widths_FloatW (hdc, uFirstChar, uLastChar, = lpabc); +} + static int memq_no_quit (Lisp_Object elt, Lisp_Object list) { @@ -2438,6 +2461,7 @@ compute_metrics (HDC dc, struct w32font_info = *w32_font, unsigned int code, GLYPHMETRICS gm; MAT2 transform; unsigned int options =3D GGO_METRICS; + ABCFLOAT abc; =20 if (w32_font->glyph_idx) options |=3D GGO_GLYPH_INDEX; @@ -2454,6 +2478,14 @@ compute_metrics (HDC dc, struct w32font_info = *w32_font, unsigned int code, metrics->width =3D gm.gmCellIncX; metrics->status =3D W32METRIC_SUCCESS; } + else if (get_char_abc_widths_float_w (dc, code, code, &abc) !=3D 0) + { + int width =3D (int) (abc.abcfA + abc.abcfB + abc.abcfC); + metrics->lbearing =3D 0; + metrics->rbearing =3D width; + metrics->width =3D width; + metrics->status =3D W32METRIC_SUCCESS; + } else metrics->status =3D W32METRIC_FAIL; } --=20 1.8.1.msysgit.1 From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 17:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch To: Tom Seddon Cc: 6364@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.138548836715615 (code B ref 6364); Tue, 26 Nov 2013 17:53:02 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 17:52:47 +0000 Received: from localhost ([127.0.0.1]:46239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlMoY-00043m-K9 for submit@debbugs.gnu.org; Tue, 26 Nov 2013 12:52:47 -0500 Received: from mtaout21.012.net.il ([80.179.55.169]:38327) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlMoS-00043N-NC for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 12:52:42 -0500 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MWV00K00TH1QU00@a-mtaout21.012.net.il> for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 19:52:30 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MWV00K1KTNHQH30@a-mtaout21.012.net.il>; Tue, 26 Nov 2013 19:52:30 +0200 (IST) Date: Tue, 26 Nov 2013 19:52:45 +0200 From: Eli Zaretskii In-reply-to: <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> X-012-Sender: halo1@inter.net.il Message-id: <83pppn9hjm.fsf@gnu.org> References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Tom Seddon > Date: Tue, 26 Nov 2013 00:35:05 +0000 > > Please find below a patch to improve the poor scrolling performance when using bitmap fonts. #14721 (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14721) and and 14307 (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14307) may also be affected. The patch has been tested against emacs 24.3. It applied cleanly to git head (22687e54e0e4d7c73c098417478574a55393fe2c) but I haven't built it. > > Performance with particularly long lines is still rather poor, but general responsiveness is much improved. (Once the buffer is fontified, emacs can now usually keep up if I hold down PgUp, PgDn, C-s, etc.) Thanks, but can you please provide a reproducible test case, including the font where the slow scrolling happens? I don't see any fonts named in these bug reports. > (I settled on GetCharABCWidthsFloatW because it works for bitmap fonts and TrueType fonts alike. But the key thing is simply not to create a DC each time w32font_text_extents is called, so there are various other functions that could be called instead if preferred.) Are there other possibilities to fix this, without using GetCharABCWidthsFloatW? The problem with that function is that it is not available on Windows 9X (in the unicows.dll library), so this problem will be left unsolved on those systems. From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Resent-From: Tom Seddon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 19:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 6364@debbugs.gnu.org Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.138549478726327 (code B ref 6364); Tue, 26 Nov 2013 19:40:02 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 19:39:47 +0000 Received: from localhost ([127.0.0.1]:46381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlOU6-0006qY-Eq for submit@debbugs.gnu.org; Tue, 26 Nov 2013 14:39:46 -0500 Received: from caiajhbdcaid.dreamhost.com ([208.97.132.83]:45303 helo=homiemail-a85.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlOU4-0006qP-1g for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 14:39:45 -0500 Received: from homiemail-a85.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a85.g.dreamhost.com (Postfix) with ESMTP id EEFF8BC04A; Tue, 26 Nov 2013 11:39:42 -0800 (PST) Received: from [192.168.1.101] (tomseddon.plus.com [212.159.116.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: tom@ouro.ltd.uk) by homiemail-a85.g.dreamhost.com (Postfix) with ESMTPSA id 5C252BC047; Tue, 26 Nov 2013 11:39:40 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) From: Tom Seddon In-Reply-To: <83pppn9hjm.fsf@gnu.org> Date: Tue, 26 Nov 2013 19:39:37 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> X-Mailer: Apple Mail (2.1822) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 26 Nov 2013, at 17:52, Eli Zaretskii wrote: >> From: Tom Seddon >> Date: Tue, 26 Nov 2013 00:35:05 +0000 >>=20 >> Please find below a patch to improve the poor scrolling performance = when using bitmap fonts. #14721 = (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14721) and and 14307 = (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14307) may also be = affected. The patch has been tested against emacs 24.3. It applied = cleanly to git head (22687e54e0e4d7c73c098417478574a55393fe2c) but I = haven't built it. >>=20 >> Performance with particularly long lines is still rather poor, but = general responsiveness is much improved. (Once the buffer is fontified, = emacs can now usually keep up if I hold down PgUp, PgDn, C-s, etc.) >=20 > Thanks, but can you please provide a reproducible test case, including > the font where the slow scrolling happens? I don't see any fonts > named in these bug reports. Certainly. I've uploaded some test cases to = http://www.tomseddon.plus.com/.emacs/bug6364.tar.gz. To reproduce: 0. visit Control Panel, Keyboard, Speed tab, and move the Repeat rate = slider all the way to "Fast". Click OK. 1. unpack bug6364.tar.gz somewhere 2. install fixed.fon (its name in the fonts list will be "fixed") 3. start shell and change to folder containing contents of = bug6364.tar.gz 4. start emacs: emacs -Q -l start-ok.el. You should see emacs load a = file, set Courier New (a truetype font) as the display font, and put = point at the end of the file. Once it's loaded, hold PgUp. Note adequate = scrolling responsiveness. 5. start emacs: emacs -Q -l start-slow.el. You should see emacs load = again, but this time with fixed.fon (a bitmap font). Once again, once = it's loaded, hold PgUp. On my PC, once it gets to about 94% of the way = through the file, the screen just stops updating. Once you stop holding = the key, after a brief pause, emacs catches up again. With my patch, both cases are pretty much the same. Try also the other included file, 16384. This doesn't have any .el files = associated with it I'm afraid as it was just a quick thing I made to see = what performance with longer lines was like. It's 16,384 lines of = 700-odd chars each. It's supposed to be viewed with fixed.fon, and = truncate-lines off. Start emacs with emacs -Q 16384, then shift+click on = the buffer to select the font. Without my patch, at the top of the file, moving the cursor downwards = from screen line to screen line is responsive, but moving it upwards is = terribly slow; with my patch, at the top of the file, moving the cursor = in either direction is responsive. With or without my patch, cursor responsiveness moving upwards is poor = towards the end of the file. >=20 >> (I settled on GetCharABCWidthsFloatW because it works for bitmap = fonts and TrueType fonts alike. But the key thing is simply not to = create a DC each time w32font_text_extents is called, so there are = various other functions that could be called instead if preferred.) >=20 > Are there other possibilities to fix this, without using > GetCharABCWidthsFloatW? The problem with that function is that it is > not available on Windows 9X (in the unicows.dll library), so this > problem will be left unsolved on those systems. I couldn't find a good list when I was writing the code so I just went = by DUMPBIN /EXPORTS and spotted it as export #158. (Don't ask me why = I've got any copies at all on my Windows 7 PC! - I expect some program = installed it just in case.) I've found an official (if outdated-looking) list now. So if = GetCharABCWidthsFloatW ends up your only objection, I'll update the code = to use a function from the official list.=20 Thanks, --Tom From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 20:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch To: Tom Seddon Cc: 6364@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.138549726630548 (code B ref 6364); Tue, 26 Nov 2013 20:22:02 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 20:21:06 +0000 Received: from localhost ([127.0.0.1]:46441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlP85-0007wc-Go for submit@debbugs.gnu.org; Tue, 26 Nov 2013 15:21:05 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:62121) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlP82-0007vx-J9 for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 15:21:03 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MWW00L000DV2P00@a-mtaout20.012.net.il> for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 22:20:12 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MWW00LPU0HN0A30@a-mtaout20.012.net.il>; Tue, 26 Nov 2013 22:20:12 +0200 (IST) Date: Tue, 26 Nov 2013 22:20:29 +0200 From: Eli Zaretskii In-reply-to: <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> X-012-Sender: halo1@inter.net.il Message-id: <83k3fuap9u.fsf@gnu.org> References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Tom Seddon > Date: Tue, 26 Nov 2013 19:39:37 +0000 > Cc: 6364@debbugs.gnu.org > > > Thanks, but can you please provide a reproducible test case, including > > the font where the slow scrolling happens? I don't see any fonts > > named in these bug reports. > > Certainly. I've uploaded some test cases to http://www.tomseddon.plus.com/.emacs/bug6364.tar.gz. Thanks, I will use that and see what I get. > > Are there other possibilities to fix this, without using > > GetCharABCWidthsFloatW? The problem with that function is that it is > > not available on Windows 9X (in the unicows.dll library), so this > > problem will be left unsolved on those systems. > > I couldn't find a good list when I was writing the code so I just went by DUMPBIN /EXPORTS and spotted it as export #158. (Don't ask me why I've got any copies at all on my Windows 7 PC! - I expect some program installed it just in case.) The export exists, but the function is a stub, not a real implementation, AFAIK. > I've found an official (if outdated-looking) list now. So if GetCharABCWidthsFloatW ends up your only objection, I'll update the code to use a function from the official list. Sorry, I don't understand what you mean. Which official list did you find, and what does it say about this? From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Resent-From: Tom Seddon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 20:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 6364@debbugs.gnu.org Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.138549785531537 (code B ref 6364); Tue, 26 Nov 2013 20:31:01 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 20:30:55 +0000 Received: from localhost ([127.0.0.1]:46450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlPHb-0008CZ-30 for submit@debbugs.gnu.org; Tue, 26 Nov 2013 15:30:55 -0500 Received: from mailbigip.dreamhost.com ([208.97.132.5]:51075 helo=homiemail-a28.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlPHX-0008CO-IW for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 15:30:52 -0500 Received: from homiemail-a28.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a28.g.dreamhost.com (Postfix) with ESMTP id AAC711B4059; Tue, 26 Nov 2013 12:30:50 -0800 (PST) Received: from [192.168.1.101] (tomseddon.plus.com [212.159.116.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: tom@ouro.ltd.uk) by homiemail-a28.g.dreamhost.com (Postfix) with ESMTPSA id E5B1B1B4057; Tue, 26 Nov 2013 12:30:45 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) From: Tom Seddon In-Reply-To: <83k3fuap9u.fsf@gnu.org> Date: Tue, 26 Nov 2013 20:30:38 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> <83k3fuap9u.fsf@gnu.org> X-Mailer: Apple Mail (2.1822) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 26 Nov 2013, at 20:20, Eli Zaretskii wrote: >> I couldn't find a good list when I was writing the code so I just = went by DUMPBIN /EXPORTS and spotted it as export #158. (Don't ask me = why I've got any copies at all on my Windows 7 PC! - I expect some = program installed it just in case.) >=20 > The export exists, but the function is a stub, not a real > implementation, AFAIK. >> I've found an official (if outdated-looking) list now. So if = GetCharABCWidthsFloatW ends up your only objection, I'll update the code = to use a function from the official list.=20 >=20 > Sorry, I don't understand what you mean. Which official list did you > find, and what does it say about this? This list: http://msdn.microsoft.com/en-us/library/ms812845.aspx - it = looks to be an outdated MSDN contents page, or something very much like, = so I assume it's at lesat fairly authoritative. (I got the link here, = which I found via google: = http://microsoft.public.platformsdk.mslayerforunicode.narkive.com/QbsrNDDh= /list-of-functions-handled-by-mslu) And under G, GetCharABCWidthsFloat is indeed missing. I suspect the page is a bit outdated, because some of the links are = broken. (And also, of course, because it deal with Windows '9x...) Thanks, --Tom From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 20:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch To: Tom Seddon Cc: 6364@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.1385498917775 (code B ref 6364); Tue, 26 Nov 2013 20:49:02 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 20:48:37 +0000 Received: from localhost ([127.0.0.1]:46464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlPYi-0000CR-Nv for submit@debbugs.gnu.org; Tue, 26 Nov 2013 15:48:37 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:35940) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlPYg-0000CB-AM for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 15:48:35 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MWW00L001L89F00@a-mtaout20.012.net.il> for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 22:48:27 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MWW00LXX1SR0AA0@a-mtaout20.012.net.il>; Tue, 26 Nov 2013 22:48:27 +0200 (IST) Date: Tue, 26 Nov 2013 22:48:45 +0200 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83ioveanyq.fsf@gnu.org> References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> <83k3fuap9u.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Tom Seddon > Date: Tue, 26 Nov 2013 20:30:38 +0000 > Cc: 6364@debbugs.gnu.org > > This list: http://msdn.microsoft.com/en-us/library/ms812845.aspx - it looks to be an outdated MSDN contents page, or something very much like, so I assume it's at lesat fairly authoritative. (I got the link here, which I found via google: http://microsoft.public.platformsdk.mslayerforunicode.narkive.com/QbsrNDDh/list-of-functions-handled-by-mslu) > > And under G, GetCharABCWidthsFloat is indeed missing. > > I suspect the page is a bit outdated, because some of the links are broken. (And also, of course, because it deal with Windows '9x...) OK. So what other function(s) can be used for this purpose? If there are no good alternatives, I guess we will go with GetCharABCWidthsFloatW anyway, since the situation cannot become worse than it is already. Btw, I used your recipe, but didn't see any significant slowdown with fixed.fon (also, the file bigline.txt is missing, I just used the 16384 thingy instead. From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Resent-From: Tom Seddon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 21:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 6364@debbugs.gnu.org Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.13855026146968 (code B ref 6364); Tue, 26 Nov 2013 21:51:02 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 21:50:14 +0000 Received: from localhost ([127.0.0.1]:46499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlQWL-0001oJ-QB for submit@debbugs.gnu.org; Tue, 26 Nov 2013 16:50:14 -0500 Received: from caiajhbdccah.dreamhost.com ([208.97.132.207]:49940 helo=homiemail-a97.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlQWH-0001o7-9y for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 16:50:10 -0500 Received: from homiemail-a97.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a97.g.dreamhost.com (Postfix) with ESMTP id DFA17286078; Tue, 26 Nov 2013 13:50:07 -0800 (PST) Received: from [192.168.1.101] (tomseddon.plus.com [212.159.116.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: tom@ouro.ltd.uk) by homiemail-a97.g.dreamhost.com (Postfix) with ESMTPSA id 038D9286058; Tue, 26 Nov 2013 13:50:05 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) From: Tom Seddon In-Reply-To: <83ioveanyq.fsf@gnu.org> Date: Tue, 26 Nov 2013 21:50:02 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> <83k3fuap9u.fsf@gnu.org> <83ioveanyq.fsf@gnu.org> X-Mailer: Apple Mail (2.1822) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 26 Nov 2013, at 20:48, Eli Zaretskii wrote: > OK. So what other function(s) can be used for this purpose? >=20 > If there are no good alternatives, I guess we will go with > GetCharABCWidthsFloatW anyway, since the situation cannot become worse > than it is already. I've changed it to GetCharWidth32, which is in the list on that MSDN = page - see patch below. I've checked this against all bitmap fonts on my = system and it produces the same results (and emacs looks to behave the = same, including in terms of performance). This function only works for bitmap fonts, but hopefully if = GetGlyphOutlineW ever fails, the reason is that the font is a bitmap = one! (And if not, and GetCharWidth32 fails too, there's the same = fallback as before in the form of GetTextExtentPoint32.) > Btw, I used your recipe, but didn't see any significant slowdown with > fixed.fon (also, the file bigline.txt is missing, I just used the > 16384 thingy instead. Agh, my mistake - I should have included start-slow.el, not = start-bigline.el. Sorry. start-slow.el looks like this: (set-face-attribute 'default nil :font "fixed") (switch-to-buffer (find-file "usb.ids")) (goto-char (point-max)) Maybe that will show up the problem? But it sounds rather like your = computer just doesn't suffer from this issue, for whatever reason... Thanks, --Tom P.S. my two PCs are as follows, and unpatched emacs performs poorly on = both of them when using bitmap fonts: - 3.4GHz Core i7 desktop, 16GB RAM, GeForce 560Ti, Windows 7 - 2.53GHz Core 2 Duo laptop, 8GB RAM, GeForce 9400M, Windows 7 (this is = a Macbook Pro - the performance is also bad running in a VM) So this could be something to do with NVidia display drivers on Windows = 7, I suppose? Though I'd expect the VM to have its own drivers, = suggesting that it might not actually be the graphics card vendor... ----------------------------------- =46rom 09fe3b0c0eb07c5ada87aee0864fa1d9478fdcf1 Mon Sep 17 00:00:00 2001 From: Tom Seddon Date: Mon, 25 Nov 2013 22:19:47 +0000 Subject: [PATCH] Use GetCharWidth32W if GetGlyphOutlineW fails. The previous fallback - which will still be used if GetCharWidth32W fails - was to call GetTextExtentPoint32W. This can be rather slow, mainly due to having to create a DC for it each time - but not to say that using the cache isn't cheaper than GetTextExtentPoint32W anyway. --- src/w32font.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/w32font.c b/src/w32font.c index 5c5a15c..08316ec 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -149,6 +149,7 @@ static BOOL g_b_init_get_outline_metrics_w; static BOOL g_b_init_get_text_metrics_w; static BOOL g_b_init_get_glyph_outline_w; static BOOL g_b_init_get_glyph_outline_w; +static BOOL g_b_init_get_char_width_32_w; =20 typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) ( HDC hdc, @@ -165,6 +166,11 @@ typedef DWORD (WINAPI * GetGlyphOutlineW_Proc) ( DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2); +typedef BOOL (WINAPI * GetCharWidth32W_Proc) ( + HDC hdc, + UINT uFirstChar, + UINT uLastChar, + LPINT lpBuffer); =20 /* Several "wide" functions we use to support the font backends are unavailable on Windows 9X, unless UNICOWS.DLL is installed (their @@ -274,6 +280,23 @@ get_glyph_outline_w (HDC hdc, UINT uChar, UINT = uFormat, LPGLYPHMETRICS lpgm, lpvBuffer, lpmat2); } =20 +static DWORD WINAPI get_char_width_32_w (HDC hdc, UINT uFirstChar, + UINT uLastChar, LPINT lpBuffer) +{ + static GetCharWidth32W_Proc s_pfn_Get_Char_Width_32W =3D NULL; + HMODULE hm_unicows =3D NULL; + if (g_b_init_get_char_width_32_w =3D=3D 0) + { + g_b_init_get_char_width_32_w =3D 1; + hm_unicows =3D w32_load_unicows_or_gdi32 (); + if (hm_unicows) + s_pfn_Get_Char_Width_32W =3D (GetCharWidth32W_Proc) + GetProcAddress (hm_unicows, "GetCharWidth32W"); + } + eassert (s_pfn_Get_Char_Width_32W !=3D NULL); + return s_pfn_Get_Char_Width_32W (hdc, uFirstChar, uLastChar, = lpBuffer); +} + static int memq_no_quit (Lisp_Object elt, Lisp_Object list) { @@ -2438,6 +2461,7 @@ compute_metrics (HDC dc, struct w32font_info = *w32_font, unsigned int code, GLYPHMETRICS gm; MAT2 transform; unsigned int options =3D GGO_METRICS; + INT width; =20 if (w32_font->glyph_idx) options |=3D GGO_GLYPH_INDEX; @@ -2454,6 +2478,13 @@ compute_metrics (HDC dc, struct w32font_info = *w32_font, unsigned int code, metrics->width =3D gm.gmCellIncX; metrics->status =3D W32METRIC_SUCCESS; } + else if (get_char_width_32_w (dc, code, code, &width) !=3D 0) + { + metrics->lbearing =3D 0; + metrics->rbearing =3D width; + metrics->width =3D width; + metrics->status =3D W32METRIC_SUCCESS; + } else metrics->status =3D W32METRIC_FAIL; } --=20 1.8.1.msysgit.1 From unknown Sun Aug 17 02:01:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Resent-From: Tom Seddon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 21:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 6364@debbugs.gnu.org Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.13855028237303 (code B ref 6364); Tue, 26 Nov 2013 21:54:01 +0000 Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 21:53:43 +0000 Received: from localhost ([127.0.0.1]:46503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlQZi-0001ti-P8 for submit@debbugs.gnu.org; Tue, 26 Nov 2013 16:53:43 -0500 Received: from caiajhbdcaib.dreamhost.com ([208.97.132.81]:50190 helo=homiemail-a97.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlQZg-0001tZ-0Z for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 16:53:40 -0500 Received: from homiemail-a97.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a97.g.dreamhost.com (Postfix) with ESMTP id 13798286058; Tue, 26 Nov 2013 13:53:39 -0800 (PST) Received: from [192.168.1.101] (tomseddon.plus.com [212.159.116.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: tom@ouro.ltd.uk) by homiemail-a97.g.dreamhost.com (Postfix) with ESMTPSA id DD03C286057; Tue, 26 Nov 2013 13:53:37 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) From: Tom Seddon In-Reply-To: Date: Tue, 26 Nov 2013 21:53:34 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <598B18C5-E5ED-4216-8D71-1C41BA283F38@tomseddon.plus.com> References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> <83k3fuap9u.fsf@gnu.org> <83ioveanyq.fsf@gnu.org> X-Mailer: Apple Mail (2.1822) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 26 Nov 2013, at 21:50, Tom Seddon wrote: > On 26 Nov 2013, at 20:48, Eli Zaretskii wrote: >=20 >> OK. So what other function(s) can be used for this purpose? >>=20 >> If there are no good alternatives, I guess we will go with >> GetCharABCWidthsFloatW anyway, since the situation cannot become = worse >> than it is already. >=20 > I've changed it to GetCharWidth32, which is in the list on that MSDN = page - see patch below. I've checked this against all bitmap fonts on my = system and it produces the same results (and emacs looks to behave the = same, including in terms of performance). Just to be clear - this patch is against unchanged emacs-24.3, not = against an emacs patched with my previous patch! So please revert my last patch before applying it. Thanks, --Tom From unknown Sun Aug 17 02:01:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: bogossian@mail.com Subject: bug#6364: closed (Re: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails.) Message-ID: References: <83wqjr79il.fsf@gnu.org> <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> X-Gnu-PR-Message: they-closed 6364 X-Gnu-PR-Package: emacs,w32 X-Gnu-PR-Keywords: patch Reply-To: 6364@debbugs.gnu.org Date: Fri, 29 Nov 2013 11:07:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1385723223-6201-1" This is a multi-part message in MIME format... ------------=_1385723223-6201-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6364: Windows: Emacs 23 slow with long lines and raster fonts which was filed against the emacs,w32 package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6364@debbugs.gnu.org. --=20 6364: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6364 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1385723223-6201-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6364-done) by debbugs.gnu.org; 29 Nov 2013 11:06:46 +0000 Received: from localhost ([127.0.0.1]:49800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmLuH-0001bY-Jo for submit@debbugs.gnu.org; Fri, 29 Nov 2013 06:06:45 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:65415) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VmLuF-0001bJ-MY for 6364-done@debbugs.gnu.org; Fri, 29 Nov 2013 06:06:44 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MX000500USVE700@a-mtaout20.012.net.il> for 6364-done@debbugs.gnu.org; Fri, 29 Nov 2013 13:06:05 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MX000507UU4DB20@a-mtaout20.012.net.il>; Fri, 29 Nov 2013 13:06:05 +0200 (IST) Date: Fri, 29 Nov 2013 13:05:54 +0200 From: Eli Zaretskii Subject: Re: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. In-reply-to: X-012-Sender: halo1@inter.net.il To: Tom Seddon Message-id: <83wqjr79il.fsf@gnu.org> References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> <83k3fuap9u.fsf@gnu.org> <83ioveanyq.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 6364-done Cc: 6364-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Tom Seddon > Date: Tue, 26 Nov 2013 21:50:02 +0000 > Cc: 6364@debbugs.gnu.org > > On 26 Nov 2013, at 20:48, Eli Zaretskii wrote: > > > OK. So what other function(s) can be used for this purpose? > > > > If there are no good alternatives, I guess we will go with > > GetCharABCWidthsFloatW anyway, since the situation cannot become worse > > than it is already. > > I've changed it to GetCharWidth32, which is in the list on that MSDN page - see patch below. I've checked this against all bitmap fonts on my system and it produces the same results (and emacs looks to behave the same, including in terms of performance). Thanks, I committed this in your name, with one change: you forgot to initialize g_b_init_get_char_width_32_w in globals_of_w32font. > > Btw, I used your recipe, but didn't see any significant slowdown with > > fixed.fon (also, the file bigline.txt is missing, I just used the > > 16384 thingy instead. > > Agh, my mistake - I should have included start-slow.el, not start-bigline.el. Sorry. start-slow.el looks like this: > > (set-face-attribute 'default nil :font "fixed") > (switch-to-buffer (find-file "usb.ids")) > (goto-char (point-max)) > > Maybe that will show up the problem? But it sounds rather like your computer just doesn't suffer from this issue, for whatever reason... I see the CPU usage decrease by half if I use Emacs with your patch with a bitmap font, so I guess the effect is visible on my system as well. Thanks. I'm closing this bug. ------------=_1385723223-6201-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Jun 2010 18:40:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLKlv-0007JX-RF for submit@debbugs.gnu.org; Sun, 06 Jun 2010 14:40:36 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLKlK-0007Ip-7J for submit@debbugs.gnu.org; Sun, 06 Jun 2010 14:39:59 -0400 Received: from lists.gnu.org ([199.232.76.165]:35754) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OLKlE-00047V-C8 for submit@debbugs.gnu.org; Sun, 06 Jun 2010 14:39:52 -0400 Received: from [140.186.70.92] (port=35008 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLKlA-00082Q-M2 for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2010 14:39:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLKl4-0001fX-CQ for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2010 14:39:46 -0400 Received: from imr-da02.mx.aol.com ([205.188.105.144]:43706) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLKl4-0001fS-AC for bug-gnu-emacs@gnu.org; Sun, 06 Jun 2010 14:39:42 -0400 Received: from imo-da03.mx.aol.com (imo-da03.mx.aol.com [205.188.169.201]) by imr-da02.mx.aol.com (8.14.1/8.14.1) with ESMTP id o56IderB030464 for ; Sun, 6 Jun 2010 14:39:40 -0400 Received: from bogossian@mail.com by imo-da03.mx.aol.com (mail_out_v42.9.) id 7.d75.9ae2e33 (34980) for ; Sun, 6 Jun 2010 14:39:36 -0400 (EDT) Received: from smtprly-dc02.mx.aol.com (smtprly-dc02.mx.aol.com [205.188.170.2]) by cia-da08.mx.aol.com (v129.4) with ESMTP id MAILCIADA085-d2f44c0beb67276; Sun, 06 Jun 2010 14:39:36 -0400 Received: from web-mmc-m08 (web-mmc-m08.sim.aol.com [64.12.224.141]) by smtprly-dc02.mx.aol.com (v129.4) with ESMTP id MAILSMTPRLYDC023-d2f44c0beb67276; Sun, 06 Jun 2010 14:39:35 -0400 To: bug-gnu-emacs@gnu.org Content-Transfer-Encoding: quoted-printable Subject: Windows: Emacs 23 slow with long lines and raster fonts Date: Sun, 06 Jun 2010 14:39:35 -0400 X-MB-Message-Source: WebUI X-AOL-IP: 82.66.250.190 X-MB-Message-Type: User MIME-Version: 1.0 From: bogossian@mail.com Content-Type: text/plain; charset="us-ascii"; format=flowed X-Mailer: Mail.com Webmail 31888-STANDARD Received: from 82.66.250.190 by web-mmc-m08.sysops.aol.com (64.12.224.141) with HTTP (WebMailUI); Sun, 06 Jun 2010 14:39:35 -0400 Message-Id: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> X-AOL-SENDER: bogossian@mail.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 06 Jun 2010 14:40:34 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.3 (-----) Hi, the Windows build of Emacs 23 is extremely slow when scrolling in a=20 buffer containing long lines if a bitmap font is used. For example, scrolling though a file made of 200 lines of 1000=20 characters each feels choppy. Doing the same with a file containing very long lines (like tens of=20 thousand characters) can make Emacs hang for seconds or minutes, making it=20 practically unusable. Editing files with such long lines is not absurd, various types of=20 computer generated files (log files, export files, dumps, ...) can have very very long lines. These bad performances are a regression, Emacs 21 and Emcas 22 were much faster in the same conditions. To illustrate this regression, and to show it's related to the use of=20 bitmap fonts, I've made this very simple and easy to reproduce benchmark: I built an 8MB file containing a single line (the content of the file doesn't matter). I opened the file in emacs, and then I hit "ESC >" to=20 reach the end of the buffer. I measured the time it takes for emacs to refresh from the moment I typed the macro. (Test setup: Athlon XP 2GHz, Windows XP SP3) If Emacs is started with the command line "emacs -q", here are the=20 results: Emacs 21.3.1: 8s Emacs 22.3.1: 14s Emacs 23.2.1: 63s (uniscribe backend) Emacs 23 can be made a little faster by forcing the gdi rendering=20 backend with the command line "emacs -q -xrm Emacs.FontBackend:gdi": Emacs 23.2.1: 38s (gdi backend) Now, if I repeat the same test using the command "emacs -q -fn=20 Courier", to use a bitmap font, things are getting really bad for Emacs 23: Emacs 21.3.1: 8s (raster font) Emacs 22.3.1: 14s (raster font) Emacs 23.2.1: 515s (raster font, gdi backend) Regards, Pierre PS: this issue has been discussed on the emacs-devel mailing list: http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00478.html ------------=_1385723223-6201-1--