unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 43237f3d27: ; * rcirc.el (rcirc-print): Prefer sleep-for over sit-for
       [not found] ` <20220219193512.0F87BC00894@vcs2.savannah.gnu.org>
@ 2022-02-19 20:01   ` Stefan Monnier
  2022-02-19 21:04     ` Philip Kaludercic
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2022-02-19 20:01 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: emacs-devel

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




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

* Re: master 43237f3d27: ; * rcirc.el (rcirc-print): Prefer sleep-for over sit-for
  2022-02-19 20:01   ` master 43237f3d27: ; * rcirc.el (rcirc-print): Prefer sleep-for over sit-for Stefan Monnier
@ 2022-02-19 21:04     ` Philip Kaludercic
  0 siblings, 0 replies; 2+ messages in thread
From: Philip Kaludercic @ 2022-02-19 21:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

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



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

end of thread, other threads:[~2022-02-19 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <164529931177.1767.11895834409261548078@vcs2.savannah.gnu.org>
     [not found] ` <20220219193512.0F87BC00894@vcs2.savannah.gnu.org>
2022-02-19 20:01   ` master 43237f3d27: ; * rcirc.el (rcirc-print): Prefer sleep-for over sit-for Stefan Monnier
2022-02-19 21:04     ` Philip Kaludercic

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).