Ensure benchmarks which need QtWidgets are gracefully disabled when
that module is unavailable.
Fixed one unnecessary usage of "QT+=widgets".
Change-Id: I8031b5dca585749f0f4d22e0637adc3f57f4e418
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Change-Id: I19d3b2e9a5180b13deb828b55195404ef20be295
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Store the signal index in QObjectPrivate::Connection, thereby making
it available in "implicit" disconnect contexts (i.e., receiver
deletion).
This change does not cause the size of QObjectPrivate::Connection
to grow (still 40 bytes on 32-bit Linux, 72 bytes on 64-bit Mac).
Valgrinding the new benchmark indicates that the percentage of the
time spent in the QObject destructor increased from 7.8% to 8.4%
on ia32, for that particular stress test; the increase is the
combined cost of calling metaObject(), QMetaObjectPrivate::signal(),
and disconnectNotify() for one connection. In practice, the measured
wallclock time increased by about 3ms for a 500ms run (which
repeatedly constructs, connects, and destroys an object).
Task-number: QTBUG-4844
Change-Id: I1beb01c753f31542fc0acb62edb4c6d165fcc5b4
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
qdatetime.h uses std::min/max and on Windows windows.h (or some subsequent
header file) may under certain circumstances define min/max as macros.
The easiest way to prevent the windows header files from doing that is to
define NOMINMAX in the place right before windows.h is included. The other
way is to define min and max to min/max themselves to prevent windows.h
from doing its evil thing.
If a user of Qt (WebKit in this case) chooses the approach of defining
min/max to themselves and then includes qdatetime.h, then a subsequent
inclusion of windows.h doesn't work because qdatetime.h undefines min/max.
We should not enforce the type of workaround needed, therefore this patch
removes the workaround from qdatetime.h and requires user code that
happens to include windows header files before qdatetime.h (seldom case)
to choose either workaround.
Change-Id: I7347eec7369491a065e894cff557004e069453d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
+ QChar::LastValidCodePoint enum value that supercede the UNICODE_LAST_CODEPOINT macro
replace uses of hardcoded values with the new API; remove leftovers
Change-Id: I1395c9840b85fcb6b08e241b131794a98773c952
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This operation should be a no-op anyway, since at this point in time,
the fromAscii and toAscii functions simply call their fromLatin1 and
toLatin1 counterparts.
Task-number: QTBUG-21872
Change-Id: I38f97ad379deafebef02c75d611343ca15640c8a
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
qVariantValue and qVariantCanConvert are Compatibility members, while in
Qt4.8 they are marked as Qt 3 Support Members.
qVariantFromValue and qVariantSetValue are Obsolete members.
Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
0xfdef-0xfdd0 is definitely 31 and not 15 :)
also fix all copy-pastes of this code (greping for '0xfdd0' helps ;)
Change-Id: I8f3bd4fd9d85f9de066f0f5df378b9188c12bd48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these
functions just to avoid an include, except to pay for it with worse runtime
performance.
On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15%
faster(!) than adding an additional call to qMemSet. The advantage on sizes
above that is unmeasurable.
For qMemCopy, the benefits are a little more modest: 16-7%.
Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: John Brooks <john.brooks@dereferenced.net>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
QT_NO_STL is now no longer defined, so remove the conditionals and
select the STL side.
Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
The use of any broken-down components of the query now needs
QUrlQuery.
The QUrl constructor and toString() are now rehabilitated and the
preferred forms. Use toEncoded() and fromEncoded() now only when we
need to store data in a QByteArray or the data comes from a QByteArray
anyway. Change to toString() or the constructor if the data was in a
QString.
Change-Id: I9d761a628bef9c70185a48e927a61779a1642342
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
QMap used to use a skiplist in Qt 4.x, which has variable
sized nodes and we can thus not optimise using custom
allocators.
The rewrite now uses a red-black tree, and all allocations
and tree operations happen in the cpp file. This will allow
us to introduce custom allocation schemes in later versions
of Qt.
Added some more tests and a benchmark. Memory consumption
of the new QMap implementation is pretty much the same as before.
Performance of insertion and lookup has increased by 10-30%. iteration
is slower, but still extremely fast and should not matter compared
to the work usually done when iterating.
Change-Id: I8796c0e4b207d01111e2ead7ae55afb464dd88f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code was only allocating memory for the next insertion
leading to a reallocation of the whole data for every
single insertion.
The code now reserves some space and uses a decent growth
strategy to avoid repeated reallocs.
Change-Id: I48b0feab71ba8ca73e7037f8460080f198b2f009
Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
- Added toByteArray() and fromByteArray() benchmark tests.
Performance tests to measure QVariantMap to bytearray
and bytearray to QVariantMap.
Use case: Interprocess communications via local socket
Change-Id: If5e94ff870890b2ebb665f3cc38f5c33b34547f4
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
- Changed benchmarks to use TESTDATA and QFINDTESTDATA
- Fixed up targets all use tst_bench_ syntax
Change-Id: I5c2936702e248478f5df225ce38893158ee22d7f
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
A case of a custom type creation was not covered before.
Change-Id: Icd2a7d63633f8e40d9d4a8a26e0eb0896fc85ec8
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
It's not faster under _any_ metric than the new algorithm, and it loses a lot of
spread which is a bad thing.
Change-Id: Ic87258f1c887822ffea1cb1517355564fabc3c26
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
We must do this the same way we do all other hash algorithms for fair
comparison, as otherwise, the call to the PLT unfairly penalises
QHash<QString>'s results, as it's in a different shared object.
Change-Id: I69c891f5a97dcccdfcfbdbf32796f86242a42963
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Per the comments on Ie4100a1ca4dbe7bf1cd73de883a9854377ac2f5e, having Q_ASSERT
was not a good idea, and data functions can't really handle
QVERIFY/QCOMPARE/etc, so do this in initTestCase instead.
Change-Id: I19e61dec7fe415bb1fa0f53a2920d99b8c7c8ea7
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Similar to the UUID benchmark, but won't have any non-numerical characters.
Change-Id: I7487c97cab96fd53c180fe12061e7be3ca96e883
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
This attempts to emulate a dictionary usecase of sorts, done in code to avoid
bloating the git repository by adding an actual word list.
Change-Id: I878bc4af8877ba780ee699932f240c0d9c8ff12c
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
In Qt5 the meta-data format will be changed to not store the
method signature string explicitly; the signature will be
reconstructed on demand from the method name and parameter type
information.
The QMetaMethod::signature() method returns a const char pointer.
Changing the return type to QByteArray can lead to silent bugs due to
the implicit conversion to char *. Even though it's a source-
incompatible change, it's therefore better to introduce a new
function, methodSignature(), and remove the old signature().
Task-number: QTBUG-24154
Change-Id: Ib3579dedd27a3c7c8914d5f1b231947be2cf4027
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
remove "header" and assignmets which are defaults or bogus,
reorder some assignments.
Change-Id: I67403872168c890ca3b696753ceb01c605d19be7
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The new layout matches that of QByteArrayData and QStringData, except
for offset which is measured from the beginning of QVectorData, whereas
in those classes it (still?) references the end of the header data.
The new layout uses an extra member for storing an offset into the data,
which will allow introducing QVector::fromRawData, similar to the same
functionality already existing in QString and QByteArray.
By not using an actual array to index array members, we also steer clear
of GCC bug #43247:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247
Change-Id: I408915aacadf616b4633bbbf5cae1fc19e415087
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This abstraction imposed serious performance penalties and is being
dropped from the public API.
In particular, by allowing file names to be arbitrarily hijacked by
different file engines, and requiring engines to be instantiated in
order to decide, it imposed unnecessary overhead on all file operations.
Another flaw in the design with direct impact on performance is how
engines have no way to provide (or retain) additional information
obtained when querying the filesystem. In many places this has meant
repeated operations on the file system, where useful information is
immediately discarded to be queried again subsequently.
For Qt 4.8 a major refactoring of the code base took place to allow
bypassing the file-engine abstraction in select places, with
considerable performance gains observed. In Qt 5 it is expected we'll be
able to take this further, reaping even more benefits, but the
abstraction has to go.
[Dropping this now does not preclude that virtual file systems make an
appearance in Qt at a later point in Qt 5's lifecycle. Hopefully with a
new and improved abstraction.]
Forward declarations for QFileExtension(Result) were dropped, as the
classes were never used or defined.
Tests using "internalized" classes will only fully run on developer
builds. QFSFileEngine was removed altogether from exception safety test,
as it isn't its intent to test internal API.
Change-Id: Ie910e6c2628be202ea9e05366b091d6d529b246b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This includes padding necessary to align the data array, but excludes the first
element as was done before. Size of header is the interesting piece of
information, anyway.
This simplifies calculations in a couple of places, harmonizes code with the
QRawVector fork and paves the way for further changes in QVector, namely the
memory layout.
When Q_ALIGNOF is not available, default to pointer-size alignment. This
should be honoured by malloc and won't trigger use of more expensive
aligned allocation.
Change-Id: I504022ac7595f69089cafd96e47a91b874d5771e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For non-movable types (QTypeInfo<T>::isStatic), QVector would grow the
array linearly, and defer to qAllocMore otherwise. That property,
however, gives no indication as to how the vector will grow.
By forcing additional allocations for growing containers of such types,
this penalized exactly those objects which are more expensive to move.
We now let qAllocMore reign in growth decisions.
Change-Id: I843a89dcdc21d09868c6b62a846a7e1e4548e399
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This patch improves performance when constructing a custom type in
a QVariant by ~ 7-20% (instructions count) depending on the type size
and metatype attributes.
Change-Id: Ic2707ff5abd689b66e23c1794f111504bf9b3b01
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Currently QMetaType API contains almost only static methods. This works
nice until someone needs more information or needs to do more operations
on a type. In this case every function call has to do type dispatch.
This API allows to avoid redundant type dispatching, by caching a
type information in a QMetaType instance. It gives significant
performance boost especially for custom types (up to 9x).
Change-Id: I223d066268402e072e41ca1d0a3e7bc160655d7f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
We should not assume that the first type id is 0.
Change-Id: I17ba6ba57e97ebd495904bfd11235fe458f214e5
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
UUIDs are a good testcase, because the textual content is all fairly similar.
This also changes data generation to be a little neater now that we're starting
to get multiple pieces of data.
Change-Id: Ie4100a1ca4dbe7bf1cd73de883a9854377ac2f5e
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Window system Macros where deprecated so use
Q_OS_WINCE for now. This code will need
some refactoring, but this is the first
step to it.
Change-Id: I5876b80ee45d4b38ac63fc7d51e775dc70bbd485
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
`make check' is intended primarily for running functional tests.
For the most part, it does not make sense to run benchmarks in the same
test environment as the functional tests.
Change-Id: I79f867fdab295bdbd4c4b3c785dfd7ede520022e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Commit 4b8ceb41ae added the requirement
that pointed-to types need to be registered when registering pointer
types. Unfortunately, the implementation also affects function pointer
types.
This change whitelists 0, 1, 2 and 3 argument functions as not deriving
from QObject, forgoing the need to workaround details of the type
registration implementation when registering those function pointer
types.
Change-Id: I4d855e9d70a8179a6e31b84623ad5bf063e0d6d8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.
Change-Id: I311e001373776812699d6efc045b5f742890c689
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>