Commit Graph

150 Commits

Author SHA1 Message Date
Kent Hansen
d359b0af2b Call QObject::disconnectNotify() when receiver is destroyed
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>
2012-06-28 14:44:20 +02:00
Oswald Buddenhagen
07581a87f8 remove some qmake -project boilerplate from project files
Change-Id: I5e6103db42b4fcca4ed4c2ffaec71e71e73d5b95
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-06-19 16:39:52 +02:00
Simon Hausmann
5230d62feb Partial fix for WebKit compilation on Windows
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>
2012-06-13 23:24:08 +02:00
Jędrzej Nowacki
d17cf14185 Implement QVector with QArrayData interface.
Change-Id: I109f46892aed2f6024459812d24922b12358814d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-05-30 17:07:27 +02:00
Konstantin Ritt
ba300f42bd QChar: add isSurrogate() and isNonCharacter() to the public API
+ 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>
2012-05-16 04:24:56 +02:00
kb
cff6e39cd1 Remove capitalization when specifying include-libraries.
MinGW installations on case-sensitive filesystems expect
lowercase names of include-libraries and (usually) include
files.
When crosscompiling on Debian 6 (targeting MS Windows) linking
fails because mingw is looking for non-existent include-libraries.
Using lowercase names solves this.

Change-Id: Id3454f4ed8ba42b6ea93d65d9c0ce567db6712df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-05-14 21:34:08 +02:00
Thiago Macieira
a637a5ae29 Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtDBus]
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: I052a3412a568ad639f2bf169b4491b56dddff1c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-05-07 05:05:30 +02:00
Thiago Macieira
de3e06a9e2 Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtOpenGL]
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: I6ea46cd6dfed75afc253fa2b4e3f1789bdad1d4e
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-05-04 12:46:31 +02:00
Thiago Macieira
dd5b373d41 Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtNetwork]
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: I94cc301ea75cc689bcb6e2d417120cf14e36808d
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-05-04 12:46:05 +02:00
Thiago Macieira
575ede308e Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtGui]
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: I2850033159508ebb1ff7564e15b99a146dbee94c
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-05-04 12:45:52 +02:00
Thiago Macieira
712ca9d95a Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtCore]
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>
2012-05-04 12:45:47 +02:00
Debao Zhang
ade8888603 Don't use obsolete qVariantValue, qVariantCanConvert, etc.
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>
2012-05-02 08:30:59 +02:00
Thiago Macieira
c4a457f8e4 Replace com.trolltech with org.qtproject in D-Bus's performance tests
I had missed these, apparently.

Task-number: QTBUG-23274
Change-Id: I6455dc34b18ec9cefccfe527b3fd3ad34fb61aa3
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
2012-04-22 21:32:24 +02:00
Sergio Ahumada
16b53b2f0e Merge "Merge remote-tracking branch 'origin/master' into api_changes" into refs/staging/api_changes 2012-04-17 10:38:24 +02:00
Jędrzej Nowacki
9b06be8646 Fix tst_qtracebench benchmark.
Default QDataStream version was changed in Qt5, but the test tried to
load an old dumped file.

Change-Id: I49c06c232ec8a27f33c9da345bae4e03cd0c56fb
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-17 06:19:42 +02:00
Lars Knoll
9bd0323551 Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
	configure
	src/corelib/io/qurl.cpp
	src/gui/kernel/qwindow.cpp
	src/tools/moc/generator.cpp
	src/widgets/kernel/qwidget_qpa.cpp
	src/widgets/styles/qstyle.h
	src/widgets/widgets/qtabbar.cpp
	tests/auto/corelib/codecs/utf8/tst_utf8.cpp

Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
2012-04-16 12:04:34 +02:00
Konstantin Ritt
9fd2edb6da replace hardcoded values with a surrogate handling methods
Change-Id: Ib41e08d835f2e8ca2e32b4025c6f5a99840f2e27
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-04-13 10:44:28 +02:00
Konstantin Ritt
9327bc87c3 fix QUtf8 codec to disallow codes in range [U+fdd0..U+fdef]
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>
2012-04-11 19:14:43 +02:00
Robin Burchell
7be255156f Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.
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>
2012-04-11 10:46:19 +02:00
Thiago Macieira
6f51fee995 Remove references to QT_NO_STL from QtCore
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>
2012-04-07 05:19:42 +02:00
Thiago Macieira
74d2dba460 Port to the new QUrl API
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>
2012-03-30 01:19:59 +02:00
Kent Hansen
3b512ae142 Merge master into api_changes
Change-Id: I93551e4d13a1b0815b359b9415060e9089477db1
2012-03-23 14:10:58 +01:00
Marc Mutz
167af3b6ca tst_qnetworkreply: don't inherit from QSharedPointer
QSharedPointer isn't meant to be used as a
base class.

Instead of inheriting from it to add implicit
conversions to and from QNetworkReply*, make
QNetworkReplyPtr a typedef, overload two
oft-used functions to take a QNetworkReplyPtr
in addition to QNetworkReply*, and otherwise
make the conversions explicit.

Change-Id: I1eff1793a19f2d5bad1cce8de74c0786675a50f3
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-03-23 11:22:40 +01:00
Lars Knoll
5cb0368516 Rewrite QMap to use a RB tree
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>
2012-03-23 09:31:09 +01:00
Lars Knoll
349c0de091 Significantly speed up insertion into QJsonObject/Array
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>
2012-03-22 18:59:45 +01:00
Kurt Korbatits
bcba6ed252 Added extra tests to json benchmark
- 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>
2012-03-22 00:00:28 +01:00
Kent Hansen
95d6f8a4cf Merge master into api_changes
Conflicts:
	src/corelib/tools/qvector.h
	tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp

Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
2012-03-19 10:03:48 +01:00
Kurt Korbatits
0f929bfa9a Fixed benchmarks to work from install directory
- 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>
2012-03-19 01:18:20 +01:00
Lars Knoll
d5098f2802 Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
	tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp

Change-Id: I884afc3b6d65c6411733a897a1949e19393573a7
2012-03-12 21:03:49 +01:00
Oswald Buddenhagen
59ae59977b use $$QT_BUILD_TREE instead of $$(QTDIR)
it's a "tad" more reliable

Change-Id: I7207daa6869d1682719cc357794cf6efff496225
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-03-08 18:55:24 +01:00
João Abecasis
79f2480c86 Merge remote-tracking branch 'origin/api_changes' into containters
Conflicts:
	src/corelib/kernel/qmetaobject.cpp
	src/corelib/kernel/qvariant.cpp
	src/tools/moc/moc.h

Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
2012-03-08 12:02:41 +01:00
Marc Mutz
278ddc9d5e chiptester benchmark: compile
The implementation uses QScrollBar, which is no longer
included by <QtGui>.

Change-Id: I2422cfccc427179ca71e9a3195f16bd637925fb3
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-08 05:31:40 +01:00
Marc Mutz
a03a71e332 examples: use QVector<QPointF> instead of QList<QPointF>
QPointF is in the category of types for which QList
is needlessly inefficient (elements are copy-constructed
onto the heap and held through pointers). Use a vector
instead. This is consistent with the QPainter API.

Change-Id: Id0e910c067a60d12fbc175e7ee7da824834be374
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-08 05:31:40 +01:00
Jędrzej Nowacki
393356f5f6 Add benchmark for QMetaType::create().
A case of a custom type creation was not covered before.

Change-Id: Icd2a7d63633f8e40d9d4a8a26e0eb0896fc85ec8
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-03-07 00:10:15 +01:00
Lars Knoll
96232be146 Merge remote-tracking branch 'origin/api_changes'
Conflicts:
	dist/changes-5.0.0
	mkspecs/features/qt_module_config.prf
	qmake/project.cpp
	qmake/property.cpp

Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
2012-03-04 21:45:05 +01:00
Stephen Kelly
e174405862 Make some tests and benchmarks pass with QT_NO_QSTRINGBUILDER
Change-Id: I6c91a613007043d0f26ac11e98353a0b9ce646ae
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-01 11:02:28 +01:00
Marc Mutz
1cd4d6b181 QEvent (and subclasses): make ctors explicit
Do this regardless of whether the event subclass
is public API or only used in examples. Examples
are examples, used by others as templates or even
copied verbatim, so they should also follow sound
engineering rules.

Anyway, there's only one in examples/...

Change-Id: I586ff16407a956c9e89288fdd4377eed73f45c0f
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-01 08:44:34 +01:00
Stephen Kelly
fb4dccee9a Fix build of QNetworkReply benchmark with QT_USE_QSTRINGBUILDER.
Change-Id: Ie46126aed0d2e83dc7784c027066c789d3fd7652
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-01 01:13:22 +01:00
Robin Burchell
b147da00c5 Remove qhash_faster.
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>
2012-02-29 22:39:00 +01:00
Robin Burchell
1f4804452c Copy Qt 4's QString hash algorithm.
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>
2012-02-29 22:39:00 +01:00
Robin Burchell
57004b7fda Move data generation to initTestCase() method and store the results.
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>
2012-02-29 22:39:00 +01:00
Robin Burchell
0f3d9b1d84 Add test data for string forms of numbers.
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>
2012-02-29 22:39:00 +01:00
Robin Burchell
693a286600 Add a test using lots of similar strings.
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>
2012-02-29 22:39:00 +01:00
Kent Hansen
96f2365cf4 Rename QMetaMethod::signature() to methodSignature()
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>
2012-02-29 12:50:14 +01:00
João Abecasis
c4ad58ed22 Merge remote-tracking branch 'gerrit/master' into containers
Change-Id: I97ba222435ff50a9e5422e6f2c73e4bb8d1b865c
2012-02-29 00:58:13 +01:00
Oswald Buddenhagen
d91cf1e53b clean up qmake-generated projects
remove "header" and assignmets which are defaults or bogus,
reorder some assignments.

Change-Id: I67403872168c890ca3b696753ceb01c605d19be7
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-02-24 05:18:30 +01:00
João Abecasis
a1621d235d Change QVector's in-memory data layout
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>
2012-02-22 17:37:29 +01:00
João Abecasis
7bbe79fe5f Drop file-engine abstraction from public API
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>
2012-02-22 00:07:31 +01:00
Shane Kearns
3f91cde588 Test for QT_NO_SSL instead of QT_NO_OPENSSL
Change the ifdefs in our own code (except openssl backend) to use the
new configure flag.

Change-Id: I8774734771c66b22164b5fae8fdb27814ac3df7b
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-02-21 15:28:40 +01:00
João Abecasis
31a0358afb Merge remote-tracking branch 'gerrit/master' into containers
Conflicts:
	src/corelib/tools/qbytearray.h

Change-Id: I03b1f3e05c9b7a45130887c522fcd9b7aa387129
2012-02-21 14:58:57 +01:00