[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: Reducing the sit-for time in w3m-process-wait-process



Katsumi Yamaoka <yamaoka@xxxxxxx> writes:
>>>>>> In [emacs-w3m : No.10494] David Engster wrote:
>> David Engster <deng@xxxxxxxxxxxxxxx> writes:
>>> I'm using the encapsulate-images feature from the shimbun package, and I
>>> noticed that when an article contains many images, it takes pretty long
>>> for w3m to fetch them. It seems to me this time is almost entirely spend
>>> on the '(sit-for 1)' in w3m-process-wait-process, while the actual w3m
>>> process is already finished. When I change this to '(sit-for 0.1)',
>>> fetching the images is much faster. It also seems to me that this speeds
>>> up refreshing shimbun groups in general.
>
>> To followup on this: I sometimes got parsing errors with '(sit-for
>> 0.1)', because the buffer didn't contain the whole output from the w3m
>> binary. However, I could fix this by using accept-process-output in the
>> w3m sentinel. Now everything works without problems, and the reduced
>> sit-for time makes working with emacs-w3m faster. Before, a w3m call
>> would at least take one second, even when w3m just received a redirect
>> or was fetching a small picture for a shimbun article. I attached the
>> two-lines patch to this mail.
>
> Great!  I verified that the patch makes shimbun fast beyond
> recognition for fetching articles containing many images.  David,
> could you provide the ChangeLog entry?

2008-12-05  David Engster  <dengste@xxxxxx>

        * w3m-proc.el (w3m-process-wait-process): Reduce sit-for time.
        (w3m-process-sentinel): Wait for process output (on Emacs only).

> However, I found one problem.  The patch makes XEmacs 21.4 and
> 21.5 slow for fetching shimbuns.  The `accept-process-output'
> line you added always seems to take one second in XEmacs,
> whereas the `sit-for' line in which the time has been reduced
> seems to make no difference. 

Well, the accept-process-output shouldn't be necessary in the first
place, since the process should be finished when the sentinel is
called. I don't really understand why Emacs sometimes doesn't have the
full w3m output in the buffer without it; it also seems to be a speed
issue. Since one cannot really use the debugger for these issues, it's
all just try and error. :-) The XEmacs behaviour could therefore be
considered correct, since there shouldn't be anymore output from the
process, and then it just waits the one second...

> I'm not sure how to solve it but I'd like to install the patch very
> much :) since I usually use Emacs, not XEmacs.  Any idea?  If no one
> comments, I'll install it in the emacs-w3m CVS trunk with the
> modification as follows:

Looks good to me, but TSUCHIYA Masatoshi's concerns are certainly
reasonable. I don't know how to really handle this, either.

Regards,
David