Given that QList<T> will allocate items on the heap when sizeof(T) is
bigger than sizeof(void *), which is the case for Phase2Data, use
QVector instead.
Details
- Reviewers
davidedmundson - Group Reviewers
KWin - Commits
- R108:548626bb4ce7: Use QVector in paintGenericScreen
Diff Detail
- Repository
- R108 KWin
- Branch
- simplify-paint-simple-screen
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 6985 Build 7003: arc lint + arc unit
Actually if we want to improve this I would go for:
- std::vector
- reserve
- emplace_back
That combination would give us zero-copy initialization of the vector and can unfortunately not be achieved with Qt's container classes.
That's due to change in Qt6.
Given that's not too far away, I don't think we should be mixing two different container class types across the core. We're just making work for ourselves. Especially when this is all just premature optimisations.
Oh, I wasn't aware of that. Where do you have that information from? I'd love to read up about it.
Given that's not too far away, I don't think we should be mixing two different container class types across the core. We're just making work for ourselves. Especially when this is all just premature optimisations.
I doubt it's premature. The code is called every frame - small things count.
Would it be okay?
phase2.reserve(stacking_order.size());
Or should we use some heuristic, e.g. num clients / num desktops?