From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Karoly.Lorentey@cern.ch (=?utf-8?Q?L=C5=91rentey_K=C3=A1roly?=) Newsgroups: gmane.emacs.devel Subject: Re: x-create-frame is sluggish Date: Mon, 11 Oct 2004 00:45:01 +0200 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <200409250239.LAA15347@etlken.m17n.org> <200410010126.KAA01376@etlken.m17n.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1852821444==" X-Trace: sea.gmane.org 1097448397 1541 80.91.229.6 (10 Oct 2004 22:46:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 10 Oct 2004 22:46:37 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 11 00:46:22 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CGmSL-0004qJ-00 for ; Mon, 11 Oct 2004 00:46:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CGmZF-0000hx-In for ged-emacs-devel@m.gmane.org; Sun, 10 Oct 2004 18:53:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CGmZ3-0000gG-96 for emacs-devel@gnu.org; Sun, 10 Oct 2004 18:53:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CGmZ2-0000fr-G3 for emacs-devel@gnu.org; Sun, 10 Oct 2004 18:53:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CGmZ2-0000fj-AZ for emacs-devel@gnu.org; Sun, 10 Oct 2004 18:53:16 -0400 Original-Received: from [157.181.151.9] (helo=mx2.elte.hu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CGmRl-0002tl-VM; Sun, 10 Oct 2004 18:45:46 -0400 Original-Received: from mailbox1.caesar.elte.hu (mailbox1.caesar.elte.hu [157.181.151.157]) by mx2.elte.hu (Postfix) with ESMTP id 0AB85283311; Mon, 11 Oct 2004 00:38:58 +0200 (CEST) Original-Received: from eris.fnord.hu (AAnnecy-251-1-39-151.w81-251.abo.wanadoo.fr [81.251.197.151]) by mailbox1.caesar.elte.hu (Postfix) with ESMTP id E0283A079701; Mon, 11 Oct 2004 00:45:18 +0200 (CEST) Original-Received: by eris.fnord.hu (Postfix, from userid 1000) id 8A2342D0; Mon, 11 Oct 2004 00:45:02 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: =?utf-8?Q?=28?= =?utf-8?Q?K=C3=A1roly=09L=C5=91rentey's?= message of "Fri, 01 Oct 2004 10:51:56 +0200") User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) X-ELTE-SpamVersion: MailScanner 4.31.6-itk1 (ELTE 1.2) SpamAssassin 2.63 ClamAV 0.73 X-ELTE-VirusStatus: clean X-ELTE-SpamCheck: no X-ELTE-SpamCheck-Details: score=-4.9, required 5.9, autolearn=not spam, BAYES_00 -4.90 X-ELTE-SpamLevel: X-ELTE-SpamScore: -4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.emacs.devel:28200 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28200 --===============1852821444== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable L=C5=91rentey K=C3=A1roly writes: > Kenichi Handa writes: >> I think the change is straight forward and not that big. >> But, for the moment, I'm too heavily overloaded to work on >> it. :-( > > I have set aside some time for hacking on this weekend. I'll see if I > can do this, then. Well, I got delayed a bit. Below is my patch for speeding up frame creation by sharing fontsets between frames. It works fine on my system; frame creation feels almost instantaneous again. I think applying it should not mess things up too badly. (An Arch changeset for this patch is available as lorentey@elte.hu--2004/emacs--fontset-cache--0--patch-3.) 2004-10-11 K=C3=A1roly L=C5=91rentey * src/xterm.h (x_output): New member `xic_base_fontname'. (FRAME_XIC_BASE_FONTNAME): New macro. (xic_delete_xfontset): Declare. * src/xfns.c (xic_create_xfontset): Share fontsets between frames based on base_fontname. (create_frame_xic): Set the frame's base_fontname. (xic_delete_xfontset): New function. (free_frame_xic): Use it. Free base_fontname. (xic_set_xfontset): Ditto. * src/xterm.c (xim_destroy_callback): Use xic_delete_fontset. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=fontset.context.patch *** diff-old/src/xfns.c 2004-10-11 00:24:05.000000000 +0200 --- diff-new/src/xfns.c 2004-10-11 00:18:09.000000000 +0200 *************** *** 1953,1959 **** --- 1953,1970 ---- char **missing_list; int missing_count; char *def_string; + Lisp_Object rest, frame; + /* See if there is another frame already using same fontset. */ + FOR_EACH_FRAME (rest, frame) + { + struct frame *cf = XFRAME (frame); + if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf) + && !strcmp (FRAME_XIC_BASE_FONTNAME (cf), base_fontname)) + return FRAME_XIC_FONTSET (cf); + } + + /* New fontset. */ xfs = XCreateFontSet (FRAME_X_DISPLAY (f), base_fontname, &missing_list, &missing_count, &def_string); *************** *** 1964,1969 **** --- 1975,2003 ---- return xfs; } + /* Free the X fontset of frame F if it is the last frame using it. */ + + void + xic_delete_xfontset (f) + struct frame *f; + { + Lisp_Object rest, frame; + + if (!FRAME_XIC_FONTSET (f)) + return; + + /* See if there is another frame sharing the same fontset. */ + FOR_EACH_FRAME (rest, frame) + { + struct frame *cf = XFRAME (frame); + if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf) + && FRAME_XIC_FONTSET (cf) == FRAME_XIC_FONTSET (f)) + return; + } + /* The fontset is not used anymore. It is safe to free it. */ + XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); + } + /* Value is the best input style, given user preferences USER (already checked to be supported by Emacs), and styles supported by the *************** *** 2101,2106 **** --- 2135,2141 ---- FRAME_XIC (f) = xic; FRAME_XIC_STYLE (f) = xic_style; FRAME_XIC_FONTSET (f) = xfs; + FRAME_XIC_BASE_FONTNAME (f) = xstrdup (base_fontname); } *************** *** 2114,2124 **** return; XDestroyIC (FRAME_XIC (f)); ! if (FRAME_XIC_FONTSET (f)) ! XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); FRAME_XIC (f) = NULL; FRAME_XIC_FONTSET (f) = NULL; } --- 2149,2161 ---- return; XDestroyIC (FRAME_XIC (f)); ! xic_delete_xfontset (f); ! if (FRAME_XIC_BASE_FONTNAME (f)) ! xfree (FRAME_XIC_BASE_FONTNAME (f)); FRAME_XIC (f) = NULL; FRAME_XIC_FONTSET (f) = NULL; + FRAME_XIC_BASE_FONTNAME (f) = NULL; } *************** *** 2207,2214 **** XFree (attr); if (FRAME_XIC_FONTSET (f)) ! XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); FRAME_XIC_FONTSET (f) = xfs; } #endif /* HAVE_X_I18N */ --- 2244,2256 ---- XFree (attr); if (FRAME_XIC_FONTSET (f)) ! xic_delete_xfontset (f); ! ! if (FRAME_XIC_BASE_FONTNAME (f)) ! xfree (FRAME_XIC_BASE_FONTNAME (f)); ! FRAME_XIC_FONTSET (f) = xfs; + FRAME_XIC_BASE_FONTNAME (f) = xstrdup (base_fontname); } #endif /* HAVE_X_I18N */ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =2D-=20 K=C3=A1roly --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBBabtu6eoyqA+yej8RAi8+AJsEMNFdNQiDCDB0VIXk8LblgpyzEACcDaHA URgAHiKFZPfn4qRuBnxTtN0= =MoMU -----END PGP SIGNATURE----- --==-=-=-- --===============1852821444== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============1852821444==--