WrappingHStack icon indicating copy to clipboard operation
WrappingHStack copied to clipboard

Optimization needed

Open dkk opened this issue 3 years ago • 3 comments

When drawing many items, for example with something like:

WrappingHStack(1...50) {
    Text("Item: \($0)")
}

it takes way too long to draw.

dkk avatar Jun 21 '21 09:06 dkk

@dkk one optimization I found helpful was to store the result of InternalWrappingHStack.firstItemOfEachLane so it's only computed once – that made the difference in being able to use this for an interactive UI with about 20 items

if you'd like I can open a PR, it's a very small change: https://github.com/scottostler/WrappingHStack/commit/4c7443014fffff09279a29bd7b351ced8ad0aa42

thanks for providing this library btw, it was just what I needed for a collection of pill buttons

scottostler avatar Jul 12 '21 22:07 scottostler

Thanks a lot. Yes, please open that PR. I'm on holidays right now, but I'll try it out as soon as I'm back.

dkk avatar Jul 18 '21 11:07 dkk

Included in release 2.1.2. I'm leaving this issue open since I still would like to write performance tests & maybe take a look if I can improve WrappingHSTack some more.

dkk avatar Jul 28 '21 12:07 dkk

Fixed at version 2.2.8

dkk avatar Dec 03 '22 14:12 dkk