Labels in a list are extremely slow on macOS
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Loading a few hundred labels are extremely slow on macos, but runs fast on Windows/Linux.
Makes it unusable on macos for anything more than a few labels.
Running instruments on macos I was able to trace most time spent to piet CoreGraphicsTextLayoutBuilder.
Not sure if the issue is there or druid itself.
Below example takes a few seconds after each click of button to load 200 labels on macos, but is instant in windows.
RichText with attributes also takes long.
A minimum working example:
```rust
use std::time::Instant;
use druid::{WidgetExt, im::Vector, WindowDesc, widget::{Flex, Button, Scroll, RawLabel, List}, Lens, Data};
#[derive(Clone,Data,Lens)]
struct AppState{
lines:druid::im::Vector
}
fn main() {
druid::AppLauncher::with_window(WindowDesc::new(ui_builder()))
.launch(AppState{lines:Vector::new()})
.expect("Run druid window");
}
fn ui_builder() -> impl druid::Widget {
Flex::column()
.with_child(
Button::new("change")
.on_click(|_,state:&mut AppState,_|{
state.lines=std::iter::repeat(format!("{:?}",Instant::now())).take(200).collect::>().into()
}))
.with_child(
Scroll::new(List::new(|| RawLabel::new()).lens(AppState::lines))
)
}
```
If someone else can test and confirm to determine if hardware/setup problem or valid issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Rust minimum working example, which renders 200 labels through Scroll, List, and RawLabel, and reproduce the delay on macOS. Compare the behavior with Windows/Linux and inspect the reported Instruments trace around piet's CoreGraphicsTextLayoutBuilder. Done means the macOS-specific slowdown is confirmed and the affected label or RichText path no longer takes several seconds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust
- Domain
- desktop, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100