Micro-optimization of list string list construction in qmetaobject.
We know the size of constructed list, so it may be worth to reserve memory space for it. Change-Id: Idad061bc1dbf5acecaec48d2e00ca3504b9db8b8 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
7628e6ed1a
commit
d121b37a4a
@ -1671,8 +1671,9 @@ void QMetaMethodPrivate::getParameterTypes(int *types) const
|
||||
QList<QByteArray> QMetaMethodPrivate::parameterTypes() const
|
||||
{
|
||||
Q_ASSERT(priv(mobj->d.data)->revision >= 7);
|
||||
QList<QByteArray> list;
|
||||
int argc = parameterCount();
|
||||
QList<QByteArray> list;
|
||||
list.reserve(argc);
|
||||
int paramsIndex = parametersDataIndex();
|
||||
for (int i = 0; i < argc; ++i)
|
||||
list += typeNameFromTypeInfo(mobj, mobj->d.data[paramsIndex + i]);
|
||||
@ -1682,8 +1683,9 @@ QList<QByteArray> QMetaMethodPrivate::parameterTypes() const
|
||||
QList<QByteArray> QMetaMethodPrivate::parameterNames() const
|
||||
{
|
||||
Q_ASSERT(priv(mobj->d.data)->revision >= 7);
|
||||
QList<QByteArray> list;
|
||||
int argc = parameterCount();
|
||||
QList<QByteArray> list;
|
||||
list.reserve(argc);
|
||||
int namesIndex = parametersDataIndex() + argc;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
list += stringData(mobj, mobj->d.data[namesIndex + i]);
|
||||
|
Loading…
Reference in New Issue
Block a user