[Development] Convenience Imports in QML
robin+qt at viroteck.net
Tue Dec 11 10:20:12 CET 2012
On Tue, Dec 11, 2012 at 4:25 AM, Alan Alpert <416365416c at gmail.com> wrote:
> import Qt 5.0
The moment I read this, I immediately had some reservations ...
... because of this:
> What's the performance impact of importing a hundred types you don't
> use? It's known to have a performance cost, perhaps this convenience
> import is bad enough for performance that we shouldn't allow people to
> shoot themselves in the foot like this.
I know the legacy "import Qt 4.7" import had a performance impact, and
for RIM, it was enough to want to patch it out altogether. I took a
slightly less over the top approach in
b5e6ca71283f0f68b7ba6d9fe9663650751ad43e ("Register Qt 4.7 import
on-demand, instead of at startup.").
So given that the design of QML has tended to be on the side of not
encouraging design decisions that have a hefty performance impact, I'd
say that this might not be such a great idea. It's the same reason I
don't like #including an entire module instead of the specific classes
used - it's convenient and easy, but all of a sudden, preprocessing
and compilation takes a hell of a lot longer - except that this is
noticable at runtime, which impacts way more than just the developer.
More information about the Development