mirror of
				https://github.com/alacritty/alacritty.git
				synced 2025-10-30 23:36:53 -04:00 
			
		
		
		
	Dynamically initialize grid storage
Previously Alacritty has initialized all lines in the buffer as soon as it is started. This had the effect that terminals which aren't making use of the scrollback buffer yet, would still consume large amounts of memory, potentially even freezing the system at startup. To resolve this problem, the grid is now dynamically resized in chunks of `1000` rows. The initial size is just the visible area itself, then every time lines are written to the terminal emulator, the grid storage is grown when required. With the worst-case scenario of having 100_000 lines scrollback configured, this change improves startup performance at the cost of scrolling performance. On my machine the startup changes from ~0.3 to ~0.2 seconds. The scrolling performance with large throughput is not affected, however it is slowed down when the number of lines scrolled are close to the 100_000 configured as scrollback. The most taxing benchmark I've found for this was running `yes | dd count=500 > 500.txt` (note the relatively small file size). This will cause a slowdown on the first run from 0.05s to 0.15s. While this is significant, it lines up with the time saved at startup. This fixes #1236.
This commit is contained in:
		
							parent
							
								
									a752066bfa
								
							
						
					
					
						commit
						3d7e88e8a9
					
				
					 6 changed files with 189 additions and 129 deletions
				
			
		| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
{"width":939.0,"height":1020.0,"cell_width":8.0,"cell_height":18.0,"padding_x":2.0,"padding_y":2.0}
 | 
			
		||||
{"width":2532.0,"height":1380.0,"cell_width":9.0,"cell_height":19.0,"padding_x":3.0,"padding_y":3.0}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue