mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 21:30:58 +00:00 
			
		
		
		
	LibWeb: Avoid allocating DOMRect objects for internal engine use
Instead of bothering the GC heap with a bunch of DOMRect allocations, we can just pass around CSSPixelRect internally in many cases. Before this change, we were generating so much DOMRect garbage that we had to do a garbage collection *every frame* on the Immich demo. This was due to the large number of intersection observers checked. We still need to relax way more when idle, but for comparison, before this change, when doing nothing for 10 seconds on Immich, we'd spend 2.5 seconds updating intersection observers. After this change, we now spend 600 ms.
This commit is contained in:
		
							parent
							
								
									bf517f9ac2
								
							
						
					
					
						commit
						f0abf5a43b
					
				
				
				Notes:
				
					github-actions[bot]
				
				2025-03-22 19:34:58 +00:00 
				
			
			Author: https://github.com/awesomekling
Commit: f0abf5a43b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4049
Reviewed-by: https://github.com/gmta
			
					 12 changed files with 79 additions and 68 deletions
				
			
		|  | @ -499,8 +499,8 @@ void HTMLSelectElement::show_the_picker_if_applicable() | |||
|     // Request select dropdown
 | ||||
|     auto weak_element = make_weak_ptr<HTMLSelectElement>(); | ||||
|     auto rect = get_bounding_client_rect(); | ||||
|     auto position = document().navigable()->to_top_level_position(Web::CSSPixelPoint { rect->x(), rect->y() + rect->height() }); | ||||
|     document().page().did_request_select_dropdown(weak_element, position, CSSPixels(rect->width()), m_select_items); | ||||
|     auto position = document().navigable()->to_top_level_position(Web::CSSPixelPoint { rect.x(), rect.bottom() }); | ||||
|     document().page().did_request_select_dropdown(weak_element, position, rect.width(), m_select_items); | ||||
|     set_is_open(true); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling