all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [sacha@myxomop.com: Re: XCreateFontSet called for each X window emacs frame is heavy]
@ 2007-07-01 16:32 Richard Stallman
  2007-07-18  1:21 ` Kenichi Handa
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2007-07-01 16:32 UTC (permalink / raw)
  To: emacs-devel, handa

Would someone please DTRT and ack?  I have enclosed two messages.
Handa, this is in your area.

Mail-Followup-To: emacs-devel@gnu.org
To: emacs-devel@gnu.org
From: Alexander Kotelnikov <sacha@myxomop.com>
Date: Sat, 30 Jun 2007 16:39:36 +0400
Organization: Global disintoxication
Lines: 78
Message-ID: <87abuhaa5z.fsf@myxomop.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: 81.211.124.120.adsl-spb.net.rol.ru
Mail-Copies-To: never
User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)
Cancel-Lock: sha1:opXAu8XBgYeajjmsERvxCfD2/l4=
X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4)
Subject: XCreateFontSet called for each X window emacs frame is heavy
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Sender: emacs-devel-bounces+rms=gnu.org@gnu.org
Errors-To: emacs-devel-bounces+rms=gnu.org@gnu.org
X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4)

Hello.

I think it is years now since I had noticed that every new emacs frame
either first or any subsequent makes all my computers feel bad. X
display stands still, cursor moves, but does not respond to clicks,
focus switches slowly. This continues of a split second, but it
hurts, I assure you. I do not know any other program, that causes
such problems.

Today I performed the following steps:
1. Checked that this feature is reproducible with emacs-snapshot from
   Debian/unstable.
2. Got emacs21 sources, built them and started emacs in debugger.

Here is the place the trouble occurs:
Breakpoint 15, create_frame_xic (f=0x849a8c0) at xfns.c:3348
3348    {
(gdb) cont
Continuing.

Breakpoint 17, xic_create_xfontset (f=0x849a8c0, 
    base_fontname=0xbfdbc270 "-*-*-medium-r-normal--13-*-*-*-*-*-*-*") at xfns.c:3310
3310      xfs = XCreateFontSet (FRAME_X_DISPLAY (f),

I suppose really a lot of fonts match this pattern.

Let's think, if something can be done to improve the situation.

Thank you for your attention

backtrace:
#0  xic_create_xfontset (f=<value optimized out>, base_fontname=<value optimized out>)
    at xfns.c:3318
#1  0x080c876a in create_frame_xic (f=0x849a8c0) at xfns.c:3408
#2  0x080ca834 in x_window (f=0x849a8c0) at xfns.c:3842
#3  0x080cee1a in Fx_create_frame (parms=1480533300) at xfns.c:4433
#4  0x08135684 in Ffuncall (nargs=2, args=0xbfdbc488) at eval.c:2659
#5  0x08161790 in Fbyte_code (bytestr=941887248, vector=1210322784, maxdepth=5)
    at bytecode.c:716
#6  0x081351c4 in funcall_lambda (fun=1210322660, nargs=1, arg_vector=0xbfdbc5b4)
    at eval.c:2851
#7  0x081355a6 in Ffuncall (nargs=2, args=0xbfdbc5b0) at eval.c:2716
#8  0x08161790 in Fbyte_code (bytestr=941841804, vector=1210277296, maxdepth=3)
    at bytecode.c:716
#9  0x081351c4 in funcall_lambda (fun=1210277212, nargs=1, arg_vector=0xbfdbc6d4)
    at eval.c:2851
#10 0x081355a6 in Ffuncall (nargs=2, args=0xbfdbc6d0) at eval.c:2716
#11 0x08161790 in Fbyte_code (bytestr=941838140, vector=1210273700, maxdepth=4)
    at bytecode.c:716
#12 0x081351c4 in funcall_lambda (fun=1210273568, nargs=0, arg_vector=0xbfdbc7f4)
    at eval.c:2851
#13 0x081355a6 in Ffuncall (nargs=1, args=0xbfdbc7f0) at eval.c:2716
#14 0x08161790 in Fbyte_code (bytestr=941992740, vector=1210429452, maxdepth=5)
    at bytecode.c:716
#15 0x081351c4 in funcall_lambda (fun=1210428172, nargs=0, arg_vector=0xbfdbc924)
    at eval.c:2851
#16 0x081355a6 in Ffuncall (nargs=1, args=0xbfdbc920) at eval.c:2716
#17 0x08161790 in Fbyte_code (bytestr=941988804, vector=1210424404, maxdepth=5)
    at bytecode.c:716
#18 0x081351c4 in funcall_lambda (fun=1210424236, nargs=0, arg_vector=0xbfdbc9f0)
    at eval.c:2851
#19 0x081353c4 in apply_lambda (fun=1210424236, args=405279788, eval_flag=1)
    at eval.c:2770
#20 0x0813469a in Feval (form=1480204196) at eval.c:2071
#21 0x080dd753 in top_level_2 () at keyboard.c:1254
#22 0x081341bf in internal_condition_case (bfun=0x80dd740 <top_level_2>, 
    handlers=405376132, hfun=0x80dfdc0 <cmd_error>) at eval.c:1267
#23 0x080df8f1 in top_level_1 () at keyboard.c:1262
#24 0x08134274 in internal_catch (tag=405337716, func=0x80df8c0 <top_level_1>, 
    arg=405279788) at eval.c:1030
#25 0x080dfa8a in command_loop () at keyboard.c:1223
#26 0x080dfb5b in recursive_edit_1 () at keyboard.c:950
#27 0x080dfc83 in Frecursive_edit () at keyboard.c:1006
#28 0x080d7f02 in main (argc=1, argv=0xbfdbd144, envp=0x0) at emacs.c:1547

-- 
Alexander Kotelnikov
Saint-Petersburg, Russia


------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
	version=3.1.0
To: rms@gnu.org
Subject: Re: XCreateFontSet called for each X window emacs frame is heavy
From: Alexander Kotelnikov <sacha@myxomop.com>
Organization: Global disintoxication
Mail-Copies-To: never
Date: Sun, 01 Jul 2007 14:50:19 +0400
In-Reply-To: <E1I4nKZ-0002jd-0M@fencepost.gnu.org> (Richard Stallman's
 message of "Sat, 30 Jun 2007 20:30:23 -0400")
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Still there. But it appears only in UTF-8 locales (I use ru_RU, but
checked with fr_FR and en_US). The problem is the last XCreateFontSet
in enclosed gdb log.

>>>>> On Sat, 30 Jun 2007 20:30:23 -0400
>>>>> "RS" == Richard Stallman <rms@gnu.org> wrote:
RS> 
RS> Would you like to try the latest Emacs release, 22.1,
RS> and see if it has the same problem?

14:34 pts/18 sacha@benington:/tmp/emacs-22.1 8> gdb src/emacs
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db
library "/lib/tls/li
bthread_db.so.1".

(gdb) break create_frame_xic
Breakpoint 1 at 0x80cf239: file xfns.c, line 2257.
(gdb) break xic_create_xfontset
Breakpoint 2 at 0x80cef8b: file xfns.c, line 2133.
(gdb) cont
The program is not being run.
(gdb) start
Breakpoint 3 at 0x80e6487: file emacs.c, line 822.
Starting program: /tmp/emacs-22.1/src/emacs 
[Thread debugging using libthread_db enabled]
[New Thread -1212270912 (LWP 30923)]
[Switching to Thread -1212270912 (LWP 30923)]
main (argc=1, argv=0xbfdb2154) at emacs.c:822
822       stack_base = &dummy;
(gdb) cont
Continuing.

Breakpoint 1, create_frame_xic (f=0x85c3fe8) at xfns.c:2257
2257    {
(gdb) cont
Continuing.

Breakpoint 2, xic_create_xfontset (f=0x85c3fe8, 
    base_fontname=0x8591aa4 "-monotype-courier
    new-medium-r-normal--13-92-100-100-m-80-ado
be-standard") at xfns.c:2133
2133      if (!base_fontname)
(gdb) next
2126    {
(gdb) 
2128      char **missing_list = NULL;
(gdb) 
2133      if (!base_fontname)
(gdb) 
2137      FOR_EACH_FRAME (rest, frame)
(gdb) 
2139          struct frame *cf = XFRAME (frame);
(gdb) 
2140          if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
(gdb) 
2152          char *fontsetname = xic_create_fontsetname
    (base_fontname, False);
(gdb) 
2155          xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
(gdb) 
2152          char *fontsetname = xic_create_fontsetname
    (base_fontname, False);
(gdb) 
2155          xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
(gdb) 

2158          if (missing_list)
(gdb) 
2160          if (! xfs)
(gdb) p fontsetname
$1 = 0x85d0c80 "-monotype-courier
new-medium-r-normal-*-13-92-100-100-m-80-adobe-standard,
- -monotype-courier
new-medium-r-normal-*-13-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-13-*-*-*-*
- -*-*-*,-*-*-*-*-*-*-13-*-*-*-*-*-*-*"
(gdb) 
- -- 
Alexander Kotelnikov
Saint-Petersburg, Russia
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [sacha@myxomop.com: Re: XCreateFontSet called for each X window emacs frame is heavy]
  2007-07-01 16:32 [sacha@myxomop.com: Re: XCreateFontSet called for each X window emacs frame is heavy] Richard Stallman
@ 2007-07-18  1:21 ` Kenichi Handa
  0 siblings, 0 replies; 2+ messages in thread
From: Kenichi Handa @ 2007-07-18  1:21 UTC (permalink / raw)
  To: rms; +Cc: sacha, emacs-devel

Sorry for the late response.

In article <E1I52LN-0006uy-Ny@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:

> Would someone please DTRT and ack?  I have enclosed two messages.
> Handa, this is in your area.

> From: Alexander Kotelnikov <sacha@myxomop.com>
> Date: Sat, 30 Jun 2007 16:39:36 +0400
> Subject: XCreateFontSet called for each X window emacs frame is heavy
[...]
> I think it is years now since I had noticed that every new emacs frame
> either first or any subsequent makes all my computers feel bad. X
> display stands still, cursor moves, but does not respond to clicks,
> focus switches slowly. This continues of a split second, but it
> hurts, I assure you. I do not know any other program, that causes
> such problems.
[...]
> 2155          xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
> (gdb) 

> 2158          if (missing_list)
> (gdb) 
> 2160          if (! xfs)
> (gdb) p fontsetname
> $1 = 0x85d0c80 "-monotype-courier
> new-medium-r-normal-*-13-92-100-100-m-80-adobe-standard,
> - -monotype-courier
> new-medium-r-normal-*-13-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-13-*-*-*-*
> - -*-*-*,-*-*-*-*-*-*-13-*-*-*-*-*-*-*"

I've never met such a problem, and it's very surprising that
XCreateFontSet is that slow.

Could you please compile the attached program (xfs.c), run
it with these arguments:

% ./xfs '-monotype-courier new-medium-r-normal-*-13-92-100-100-m-80-adobe-standard,-monotype-courier new-medium-r-normal-*-13-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-13-*-*-*-*-*-*-*,-*-*-*-*-*-*-13-*-*-*-*-*-*-*'

%./xfs ''-monotype-courier new-medium-r-normal-*-13-92-100-100-m-80-adobe-standard,-monotype-courier new-medium-r-normal-*-13-*-*-*-*-*-*-*,-*-*-medium-r-normal-*-13-*-*-*-*-*-*-*'

%./xfs ''-monotype-courier new-medium-r-normal-*-13-92-100-100-m-80-adobe-standard,-monotype-courier new-medium-r-normal-*-13-*-*-*-*-*-*-*'

and check if they are surely slow?

And also please investigate why the following code in
xic_create_xfontset doesn't find an already created fontset
for the second and the other frames.

  /* 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)
          && FRAME_X_DISPLAY_INFO (cf) == FRAME_X_DISPLAY_INFO (f)
          && FRAME_XIC_BASE_FONTNAME (cf)
          && !strcmp (FRAME_XIC_BASE_FONTNAME (cf), base_fontname))
        {
          xfs = FRAME_XIC_FONTSET (cf);
          break;
        }
    }

---
Kenichi Handa
handa@m17n.org

--------------------- xfs.c -------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <X11/Xlib.h>

int
main (int argc, char **argv)
{
  Display *display;
  XFontSet xfs = NULL;
  char **missing_list = NULL;
  int missing_count;
  char *def_string;

  setlocale (LC_ALL, "");

  display = XOpenDisplay (NULL);
  xfs = XCreateFontSet (display, argv[1], &missing_list, &missing_count,
			&def_string);
  if (! xfs)
    printf ("Fontset can't be created from \"%s\".\n", argv[1]);
  else
    {
      printf ("Fontset created successfully.\n");
      if (missing_list)
	{
	  int i;

	  printf ("Missing fonts:\n");
	  for (i = 0; i < missing_count; i++)
	    printf ("  %s\n", missing_list[i]);
	  XFreeStringList (missing_list);
	}
      XFreeFontSet (display, xfs);
    }

  XCloseDisplay (display);
  exit (0);
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-18  1:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-01 16:32 [sacha@myxomop.com: Re: XCreateFontSet called for each X window emacs frame is heavy] Richard Stallman
2007-07-18  1:21 ` Kenichi Handa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.