emacs-devel
[Top][All Lists]
Advanced

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

Re: master 43237f3d27: ; * rcirc.el (rcirc-print): Prefer sleep-for over


From: Philip Kaludercic
Subject: Re: master 43237f3d27: ; * rcirc.el (rcirc-print): Prefer sleep-for over sit-for
Date: Sat, 19 Feb 2022 21:04:23 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Philip Kaludercic [2022-02-19 14:35:11] wrote:
>> branch: master
>> commit 43237f3d27897e2a0c6de745770802d0ba40e3a5
>> Author: Philip Kaludercic <philipk@posteo.net>
>> Commit: Philip Kaludercic <philipk@posteo.net>
>>
>>     ; * rcirc.el (rcirc-print): Prefer sleep-for over sit-for
>>     
>>     Compare
>>     
>>             (benchmark-run 100000 (sit-for 0))
>>             ;; => (2.600030102 12 1.523461324000003)
>>     
>>     with
>>     
>>             (benchmark-run 100000 (sleep-for 0))
>>             ;; (0.015882939 0 0.0)
>
> I think that's because `sleep-for` doesn't redisplay whereas `sit-for`
> (usually) does.
>
>> -        (sit-for 0)                 ; displayed text before hook
>> +        (sleep-for 0)                       ; displayed text before hook
>
> What is this for?  The comment suggests it might be because you want to
> force a redisplay, but if `sleep-for` does the trick apparently that's not it.
>
>
>         Stefan
>

Eli Zaretskii <eliz@gnu.org> writes:

>>     ; * rcirc.el (rcirc-print): Prefer sleep-for over sit-for
>> 
>>     Compare
>> 
>>             (benchmark-run 100000 (sit-for 0))
>>             ;; => (2.600030102 12 1.523461324000003)
>> 
>>     with
>> 
>>             (benchmark-run 100000 (sleep-for 0))
>>             ;; (0.015882939 0 0.0)
>> 
>> diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
>> index 9d1600e..9bbba6d 100644
>> --- a/lisp/net/rcirc.el
>> +++ b/lisp/net/rcirc.el
>> @@ -2043,7 +2043,7 @@ rcirc-print
>>                         rcirc-log-process-buffers))
>>            (rcirc-log process sender response target text))
>> 
>> -        (sit-for 0)                    ; displayed text before hook
>> +        (sleep-for 0)                  ; displayed text before hook
>
> Really?  Why?
>
> sleep-for with the argument of zero is a fancy way of doing nothing,
> so it definitely is going to be "faster".  But then why call it at
> all?
>
> The sit-for call was there to trigger redisplay.  Now that's gone.
>
> I think you should revert that, or at least do something other than
> call sleep-for with a zero argument.

There was a misunderstanding on my end, I will revert the commit.  My
assumption was that sit-for was slower (hence slowing down playback)
because it was also listening for input.  I had been testing the change
for a while and it seemed to not break anything, but I hadn't looked at
it close enough.  Sorry about that.

-- 
        Philip Kaludercic



reply via email to

[Prev in Thread] Current Thread [Next in Thread]