Mark
11/14/2023, 4:03 AMTextMeasurer in my composables. Should I be passing this around as an argument (many composables) or just using rememberTextMeasurer where needed?Halil Ozercan
11/14/2023, 1:42 PMrememberTextMeasurer would initialize a new TextMeasurer for you with a separate cache. If you are not using the cache (as in specifying cacheSize as 0) then you can safely pass the TextMeasurer to other composables and save yourself extra few allocations.
However, if you are taking advantage of the internal cache, then all your measure calls in all the different composables would be hitting the same cache. If you do not have a sufficiently large sized cache, then you may run into lots of cache misses which would be a more serious problem for performance. In that case I'd recommend you to just use rememberTextMeasurer in each Composable.