mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
layout: get rid of some collect() calls (#42327)
Profiling a speedometer run showed significant time spent in some layout function in vector allocations. The main change is to switch the result of `query_box_areas()` from a Vec<T> to and iterator. Testing: refactoring with no expected test changes Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
@@ -56,11 +56,11 @@ use js::rust::{
|
||||
MutableHandleValue,
|
||||
};
|
||||
use layout_api::{
|
||||
BoxAreaType, ElementsFromPointFlags, ElementsFromPointResult, FragmentType, Layout,
|
||||
LayoutImageDestination, PendingImage, PendingImageState, PendingRasterizationImage,
|
||||
PhysicalSides, QueryMsg, ReflowGoal, ReflowPhasesRun, ReflowRequest, ReflowRequestRestyle,
|
||||
RestyleReason, ScrollContainerQueryFlags, ScrollContainerResponse, TrustedNodeAddress,
|
||||
combine_id_with_fragment_type,
|
||||
BoxAreaType, CSSPixelRectIterator, ElementsFromPointFlags, ElementsFromPointResult,
|
||||
FragmentType, Layout, LayoutImageDestination, PendingImage, PendingImageState,
|
||||
PendingRasterizationImage, PhysicalSides, QueryMsg, ReflowGoal, ReflowPhasesRun, ReflowRequest,
|
||||
ReflowRequestRestyle, RestyleReason, ScrollContainerQueryFlags, ScrollContainerResponse,
|
||||
TrustedNodeAddress, combine_id_with_fragment_type,
|
||||
};
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
use media::WindowGLContext;
|
||||
@@ -2851,11 +2851,7 @@ impl Window {
|
||||
self.box_area_query_without_reflow(node, area, exclude_transform_and_inline)
|
||||
}
|
||||
|
||||
pub(crate) fn box_areas_query(
|
||||
&self,
|
||||
node: &Node,
|
||||
area: BoxAreaType,
|
||||
) -> Vec<Rect<Au, CSSPixel>> {
|
||||
pub(crate) fn box_areas_query(&self, node: &Node, area: BoxAreaType) -> CSSPixelRectIterator {
|
||||
self.layout_reflow(QueryMsg::BoxAreas);
|
||||
self.layout
|
||||
.borrow()
|
||||
|
||||
Reference in New Issue
Block a user