aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickparticleflatset_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Add "we mean it" comment to private headerVolker Hilsheimer2020-08-251-0/+11
| | | | | | | | Fixes warning from build system. Change-Id: If6c7885fa19f17b5821142176b6239bb337a6022 Pick-to: 5.15 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Particles: reduce memory allocations by flattening a setGiuseppe D'Angelo2020-05-271-0/+145
When an affector acts on a particle, it will add it to a set of "seen" particles. This means an allocation, per particle, per frame. In Qt 6 the problem is less dramatic due to the new QHash implementation, which uses "wider" buckets, but in Qt 5 this is hundreds of memory allocations (and deallocations) per frame. Just reimplement a minimal flat-set API for this use case, and replace the QSet usages with it. On a testcase with 200 active particles, this reduces memory allocations from ~20'000 per second to 0 when the scene is "stable". Pick-to: 5.15 Change-Id: I4be1e12a23b8dffca91955148532db243e383a4c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>