emacs-devel
[Top][All Lists]
Advanced

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

Re: Question about üarent-frame changes


From: Gerd Möllmann
Subject: Re: Question about üarent-frame changes
Date: Sat, 28 Sep 2024 11:10:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>
>> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>>
>>> Robert Pluim <rpluim@gmail.com> writes:
>>>
>>>>     martin> Reparenting is useful because you can set up one child frame 
>>>> for some
>>>>     martin> special purpose, make it invisible when you don't need it, and 
>>>> move it
>>>>     martin> to another frame and make it visible there whenever you want 
>>>> to.  On
>>>>     martin> GUIs, this approach has the advantage that you can avoid the 
>>>> (at least
>>>>     martin> here) costly process of setting up frame faces every time 
>>>> anew.  Emacs
>>>>     martin> tooltips do that by default and I recall that showing a 
>>>> tooltip every
>>>>     martin> time incurred two entire GC cycles here.
>>>>
>>>> Would setting up frame faces be that expensive on tty? Iʼd really love
>>>> to have tty child frames, even if they were not blazingly fast.
>>>
>>>> From what I've seen so far, it's pretty fast, but OTOH my machine is
>>> pretty fast (M1 pro). Let's see how it does when I'm a bit further. At
>>> least hiding frames on ttys should be there before I can really try it
>>> with posframe. Maybe also moving/resizing also.
>>
>> I think I can say now that it will probably be faster than on GUI, at
>> least on macOS. Running
>>
>>   (defun my-make-child ()
>>     (interactive)
>>     (make-frame `((parent-frame . ,(selected-frame))
>>                   (background-color . "gray10")
>>                   (foreground-color . "white")
>>                   (top . 15)
>>                   (left . 40)
>>                   (width . 80)
>>                   (height . 25))))
>>
>>   (defun my-time-child ()
>>     (interactive)
>>     (dotimes (i 500)
>>       (let ((f (my-make-child)))
>>         (sit-for 0)
>>         (delete-frame f))))
>>
>>   (benchmark-run 1 (my-time-child))
>>
>> shows 24s with GUI, and 8s on tty. I'm using Alacritty, in case that matters
>> (for the KKP keyboard support, not for performance).
>
> Small correction - I had timed tty build with debug. It's actually 2s
> instead of 8s.

I think I have hiding/showing child frames now. Timing this:

  (defun my-time-hide ()
    (interactive)
      (let ((f (my-make-child)))
        (dotimes (i 500)
          (make-frame-invisible f)
          (sit-for 0)
          (make-frame-visible f)
          (sit-for 0))))

gives 0.3s on ttys, and 8.5s with Cocoa. Not too shabby :-).

Also note that it's ca, 3 times faster on Cocoa than deleting and
recreating the child frame is. That's ca. 17ms. And it's I think what
Corfu and Posframe do (not 100% sure about Posframe).



reply via email to

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