`run emacs' in win32 console cause bad emacs performance

View: New views
7 Messages — Rating Filter:   Alert me  

`run emacs' in win32 console cause bad emacs performance

by Haojun Bao-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

When I start emacs (alternated to emacs-X11) with `run emacs' on the
Windows console (started with the Cygwin.bat shortcut), the emacs
performance is not good (moving the cursor up/down is not smooth), and
not stable (hang/crash sometimes).

But if started directly with `emacs' or from the Start Menu shortcut of
emacs (C:\cygwin\bin\run.exe -p /usr/X11R6/bin emacs -display 127.0.0.1:0.0),
then all is good. Also good if started with `run emacs' in a
RXVT/PUTTY-CYG console.

One difference I see is the /proc/`emacs pid'/fd, in the former way,
there is only one fd:

    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 0 -> socket:[1608]=

I believe this fd is the connection to X server; if started otherwise,
the fd list is:

    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 0 -> /dev/console
    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 1 -> /dev/console
    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 2 -> /dev/console
    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 3 -> socket:[1624]=
   
or with /dev/console changed to /dev/ttyN.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Re: `run emacs' in win32 console cause bad emacs performance

by Ken Brown-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 7/2/2009 11:54 PM, Haojun Bao wrote:
> When I start emacs (alternated to emacs-X11) with `run emacs' on the
> Windows console (started with the Cygwin.bat shortcut), the emacs
> performance is not good (moving the cursor up/down is not smooth), and
> not stable (hang/crash sometimes).

I can't reproduce this, but you haven't really given enough details.  I
don't know if you're using cygwin 1.5 or 1.7, or which version of emacs
you're running, or....

   http://cygwin.com/problems.html
   http://www.catb.org/~esr/faqs/smart-questions.html

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Re: `run emacs' in win32 console cause bad emacs performance

by Haojun Bao-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

procmon.tgz (15K) Download Attachment

Re: `run emacs' in win32 console cause bad emacs performance

by Ken Brown-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 7/3/2009 12:43 PM, Haojun Bao wrote:
[empty message with attachment]

Was this supposed to be a reply to my request for more information?
I'll repeat what I said:

> I can't reproduce this, but you haven't really given enough details.
> I don't know if you're using cygwin 1.5 or 1.7, or which version of
> emacs you're running, or....
>
>   http://cygwin.com/problems.html
>   http://www.catb.org/~esr/faqs/smart-questions.html

Please look at those two links and follow the guidelines for reporting a
problem.

Ken


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Re: `run emacs' in win32 console cause bad emacs performance

by Haojun Bao-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ken Brown <kbrown@...> writes:

> On 7/3/2009 12:43 PM, Haojun Bao wrote:
> [empty message with attachment]
>
> Was this supposed to be a reply to my request for more information?
> I'll repeat what I said:
>
>> I can't reproduce this, but you haven't really given enough details.
>> I don't know if you're using cygwin 1.5 or 1.7, or which version of
>> emacs you're running, or....
>>
>>   http://cygwin.com/problems.html
>>   http://www.catb.org/~esr/faqs/smart-questions.html
>
> Please look at those two links and follow the guidelines for reporting
> a problem.

ehhh, man, very sorry, I might been busted by gmail, I don't know how
 this happen. The following is the reply I wrote to your
 request. Luckily Gmail saved it in Sent Mail.

Here it is, without the attachment:

----------------------------------------------------------------

Sorry.

Cygwin is 1.7, I update very often, and I can reproduce it both at home
and in office.

Here's the steps to reproduce it:

0. Start X, and set DISPLAY:
  $startxwin.sh
  $export DISPLAY=:0

1. start bash from cygwin.bat:
   $cygstart /Cygwin.bat

2. In the cygwin.bat console window, start emacs-X11 using run.exe:
  $run emacs-X11.exe -q


3. In the emacs window, move cursor up/down, take a note it's speed, and
run:
   $ps aux|grep emacs
   $ls -l /proc/3804/fd/  #3804 is the emacs pid
Here's the output:
   lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 0 -> socket:[1584]=

a2. Quit emacs, start it again in cygwin.bat window, this time use:
   $emacs-X11.exe -q #without the `run'

a3. In the emacs window, move cursor up/down, I can see it's smoother
this time.  It's reproducible on my PCs both at home/office. And the fd
list:
   lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 0 -> /dev/console
   lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 1 -> /dev/console
   lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 2 -> /dev/console
   lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 3 -> socket:[1612]=

Also, I used Procmon to see how emacs is doing. Emacs is sending/recving
lots of TCP packets to localhost 1053 (X server I guess), but in the 1st
case, 552/861 of their sizes are 32 bytes, while on the 2nd case, 318
out of 723 packets are of size 32.

Also, I checked how many of the packets are of size [100, 1000), the
result is more illustrative, in the 1st case, 86/861, in the second
case, 281/723

The Procmon result with only TCP data is attached, after unpack, there
is a slow.csv and a fast.csv.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Re: `run emacs' in win32 console cause bad emacs performance

by Haojun Bao-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Haojun Bao <baohaojun@...> writes:

> Ken Brown <kbrown@...> writes:
>
>> On 7/3/2009 12:43 PM, Haojun Bao wrote:
>> [empty message with attachment]
>>
>> Was this supposed to be a reply to my request for more information?
>> I'll repeat what I said:
>>
>>> I can't reproduce this, but you haven't really given enough details.
>>> I don't know if you're using cygwin 1.5 or 1.7, or which version of
>>> emacs you're running, or....
>>>
>>>   http://cygwin.com/problems.html
>>>   http://www.catb.org/~esr/faqs/smart-questions.html
>>
>> Please look at those two links and follow the guidelines for reporting
>> a problem.
>
> ...
> 3. In the emacs window, move cursor up/down, take a note it's speed, and
> run:
>    $ps aux|grep emacs
>    $ls -l /proc/3804/fd/  #3804 is the emacs pid
> Here's the output:
>    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 0 -> socket:[1584]=
>
> ...
> a3. In the emacs window, move cursor up/down, I can see it's smoother
> this time.  It's reproducible on my PCs both at home/office. And the fd
> list:
>    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 0 -> /dev/console
>    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 1 -> /dev/console
>    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 2 -> /dev/console
>    lrwxrwxrwx 1 bhj None 0 2006-12-01 08:00 3 -> socket:[1612]=
>

hi, I have simplified the test case a bit. Wrote 2 .py files, one I get
 slow emacs, the other I get normal(smooth) emacs:

$cat slow.py
#!/bin/python
import os
os.close(0)
os.close(1)
os.close(2)
#must make sure X server is running already, or else this doesn't show
#anything, even no -nw version of emacs. my /bin/emacs is alternative to
#/usr/bin/emacs-X11
os.system("emacs -q")

$cat fast.py
#!/bin/python
import os
os.system("emacs -q")

(And my original problem is `run emacs' in cygwin.bat console will cause
emacs slow, and I observed there's only one fd (socket to X) open for
the emacs process started this way; no stdin/out/err).

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Re: `run emacs' in win32 console cause bad emacs performance

by Ken Brown-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 7/4/2009 9:35 AM, Haojun Bao wrote:

> Cygwin is 1.7, I update very often, and I can reproduce it both at home
> and in office.
>
> Here's the steps to reproduce it:
>
> 0. Start X, and set DISPLAY:
>   $startxwin.sh
>   $export DISPLAY=:0
>
> 1. start bash from cygwin.bat:
>    $cygstart /Cygwin.bat
>
> 2. In the cygwin.bat console window, start emacs-X11 using run.exe:
>   $run emacs-X11.exe -q
>
>
> 3. In the emacs window, move cursor up/down, take a note it's speed,

OK, I can reproduce it now.  The fix is to make sure your CYGWIN
environment variable contains tty before starting the console.  I use a
modified Cygwin.bat that does this.  (That's why I couldn't reproduce
your problem the first time I tried.)

$ cat bin/Cygwin.bat
@echo off
C:
chdir C:\cygwin-1.7\bin
SET CYGWIN=%CYGWIN% tty
bash --login -i

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple