mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Before this patch, polyline generation did lots of small allocations over and over again. Now, `Path::CreatePolyline` takes a `std::vector<Point>` that the caller can reserve such that it won't likely need to be resized. The tessellator has been updated to hold a thread_local point buffer that gets reused and avoids lots of intra-frame allocation. This improves the profiles seen in https://github.com/flutter/flutter/issues/138004, specifically around the [`FillPointsForPolyline` time](https://user-images.githubusercontent.com/8975114/281116688-2d519d24-7838-405c-9e99-df5ceacf0917.png) This very significantly improves the benchmarking data in geometry_benchmarks. The first commit in this patch _slightly_ improves the benchmarks by reducing some allocations, but not enough of them.