You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reduce allocations during resize with (setq frame-resize-pixelwise t) in your init! #66
During resize, every 100ms (a rate which emacs itself may determine), a brand new pair of IOSurfaces are allocated (for the front and back frame buffer), at 5-50MB a pop. Pretty inefficient.
A better approach might be to limit the view of the IOSurface and resize it only to make it larger (at least during resize), with some increment like 25%, as needed. One complications is we also have old-school CGImage buffers and the new (optional) Metal buffers too, so they'd also need the same treatment. But could start with IOSurfaces. Once a given resize has completed (viewDidEndLiveResize) a "correct-size" frame buffer pair can be re-allocated.
Update:@gerd-moellmann suggested enabling frame-resize-pixelwise in the init. Not only does this make resizing very smooth, it entirely eliminates all the allocations of IOSurface VM.
Instruments Allocations:
Each of the following is a report from Instruments "Allocation" run sorted by Total Bytes. Each is about 11s worth of rapid resizing of the sole frame, showing my init.el (this is the emacs-30 branch).
Note in particular the last line in each: 2 persistent IOSurface allocations each (front/back frame buffer), but 214 temporary allocations totalling 2.3GB without pixelwise. I don't understand the reason for this difference, but I'll take it! Update: it doesn't redraw at all during resize until you release, but that's fine.
Recommendation
(setq frame-resize-pixelwise t)
in your init.el!
Reacted by gerd-moellmann, Przemysław Kryger, Ben Simms and Thor Adam
changed the title [-]Idea: reduce allocations during resize[/-][+]Reduce allocations during resize with `(setq frame-resize-pixelwise t)` in your init![/+]on Aug 3, 2025
On the other hand, frame-resize-pixelwise prevents redisplay (somehow) during pixel-precise resize. Maybe this limitation could still be lifted with conservative only-growing frame buffer allocation. Worth looking at.
Repository owner locked and limited conversation to collaborators on Sep 13, 2025
Activity
jdtsmith commentedon Aug 3, 2025
Update: @gerd-moellmann suggested enabling
frame-resize-pixelwisein the init. Not only does this make resizing very smooth, it entirely eliminates all the allocations ofIOSurfaceVM.Instruments Allocations:
Each of the following is a report from
Instruments"Allocation" run sorted byTotal Bytes. Each is about 11s worth of rapid resizing of the sole frame, showing myinit.el(this is the emacs-30 branch).Without
pixelwiseWith
pixelwiseNote in particular the last line in each: 2 persistent
IOSurfaceallocations each (front/back frame buffer), but 214 temporary allocations totalling 2.3GB withoutpixelwise. I don't understand the reason for this difference, but I'll take it! Update: it doesn't redraw at all during resize until you release, but that's fine.Recommendation
in your
init.el![-]Idea: reduce allocations during resize[/-][+]Reduce allocations during resize with `(setq frame-resize-pixelwise t)` in your init![/+]jdtsmith commentedon Aug 5, 2025
On the other hand,
frame-resize-pixelwiseprevents redisplay (somehow) during pixel-precise resize. Maybe this limitation could still be lifted with conservative only-growing frame buffer allocation. Worth looking at.