[Development] QML Demo has a higher memory usage than Wdiget Demo

YaNing Lu dluyaning at gmail.com
Fri Jun 17 03:50:55 CEST 2022


Many thanks Volker,

Your reply is very helpful to me.
I am currently using Qt5.15 (due to various reasons, I am not ready to use
Qt6 yet),
and I found that QML applications will depend on the Widgets library.
Referring to Qt6,
I separated Qt5 svgwidget and opengwidget, so that there is some
optimization effect
at present. Don't know if there are other similar optimizations in Qt6.

Regards,
--
Lu YaNing


Volker Hilsheimer <volker.hilsheimer at qt.io> 于2022年6月16日周四 13:46写道:

> QML/Qt Quick and Widgets are based on fundamentally different rendering
> technologies.
>
> Widget applications have a backing store, which is (simplified) a raster
> image for each toplevel window; that raster image has as many pixels as
> required for the size of the window. When a line or text is drawn, pixels
> are put into that backingstore image, which is then put on screen. Some
> caching happens in Qt (for glyphs, small pixmaps, etc), but there is no
> data structure maintained that represents the individual paint instructions.
>
> Qt Quick is based on a scene graph, which the GPU can very efficiently
> operate on. That scene graph stores vectorized representations of rendering
> primitives (quads and triangles), as well as textures, shader programmes,
> etc. This data structures needs to live somewhere in memory.
>
> This is just one aspect. The QML engine’s data structures compared to the
> purely binary compiled C++ is another aspect.
>
>
> So, comparing the memory footprint of Quick and Widget applications is
> comparing apples and pears. Keeping their memory footprint equivalent is,
> generally speaking and by itself, not a meaningful goal.
>
>
> Volker
>
>
>
>
> > On 16 Jun 2022, at 14:32, YaNing Lu <dluyaning at gmail.com> wrote:
> >
> > >
> > You didn't answer the question.
> >
> > >
> > >
> > The difference is that QML is a different technology from widgets.
> >
> > >
> > >
> > If you want more details, please use a memory profiler to size the heap
> (as
> >
> > >opposed to memory mappings) and find out consumes most memory.
> >
> > Thanks Thiago,
> >
> > I understand that my program has a high memory footprint, which has a
> > lot to do with my implementation, so I just wrote the demo for
> comparison.
> > QML and widgets use different technologies, can I understand the meaning
> > of no comparison between qml and widgets programs.
> >
> > BTW, I re-uploaded my demo in
> https://bugreports.qt.io/browse/QTBUG-104322.
> > In fact, my problem is that there are two:
> >
> > Why does qml have higher memory usage than widgets.(At present, I am
> also
> > analyzing through source code and memory detection tools)
> >
> > If optimized based on qml demo, how to make its memory usage consistent
> > with widget demo or similar.
> >
> > Regards,
> > --
> > Lu YaNing
> >
> > Thiago Macieira <thiago.macieira at intel.com> 于2022年6月15日周三 16:05写道:
> > On Wednesday, 15 June 2022 02:51:27 PDT YaNing Lu wrote:
> > > We read the USS of the demo for comparison, and the following is the
> > > comparison data.
> > >
> > > 5.15.2
> > > qml-demo : 31.3M
> > > widget-demo : 24.7M
> > >
> > > 6.2.4
> > > qml-demo : 36.0M
> > > widget-demo : 22.4M
> >
> > What are you measuring here? What tool did you use?
> >
> > --
> > Thiago Macieira - thiago.macieira (AT) intel.com
> >   Cloud Software Architect - Intel DCAI Cloud Engineering
> >
> >
> >
> > _______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > https://lists.qt-project.org/listinfo/development
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220617/67461d58/attachment-0001.htm>


More information about the Development mailing list