summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
Commit message (Collapse)AuthorAgeFilesLines
* Make QStringRef::right() consistent with QString::right()Eskil Abrahamsen Blomfeldt2014-10-142-2/+2
| | | | | | | | | | | | | | | | | | | | | The implementation was inconsistent with QString::right(), and did not return the N rightmost characters but actually did the same as QString::mid(N) (returning the rightmost size - N characters.) Since this function is fairly recent (Qt 5.2), is documented to behave the same as QString::right(), and since these APIs are meant to be interchangeable, this needs to be fixed, even though it changes behavior. [ChangeLog][Important Behavior Changes] Changed QStringRef::right() to be consistent with QString::right(). The function now returns the N right-most characters, like the documentation already claimed. Change-Id: I2d1cd6d958dfa9354aa09f16bd27b1ed209c2d11 Task-number: QTBUG-41858 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Don't stream QStringLiterals into QDebugMarc Mutz2014-10-091-1/+1
| | | | | | | | Normal (C) string literals do just as well and use more than twice less space in the DATA section. Change-Id: Iafb0682a362c41dfd5b4d8b9137d88014d7992a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't use QStringLiteral in comparisonsMarc Mutz2014-10-093-5/+5
| | | | | | | | | | | | | | For QLatin1String, operator== is overloaded, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just compare using QLatin1String instead. Change-Id: I7af3bf3a67c55dae33ffaf9922d004fa168a3f9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Oswald Buddenhagen2014-10-062-5/+12
|\ | | | | | | Change-Id: I132bb6cce68e9f8413200f7ee75586bd1cada38c
| * Doc: Clarify QBitArray::fill() documentationTopi Reinio2014-10-031-3/+10
| | | | | | | | | | | | | | | | | | | | Fix a minor mistake in the the function parameter documentation, and add a code snippet. Task-number: QTBUG-39782 Change-Id: Ia5d88a983ad683ae5bde9f332d51adc4afda77a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Avoid naming clashes with QStringLiteral local variableKai Koehne2014-10-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSVC 2013 complains about the use of 's' if a variable 's' is already defined in the context: error C2373: 's' : redefinition; different type modifiers error C3493: 's' cannot be implicitly captured because no default capture mode has been specified This looks like a compiler bug. Anyhow, it's easy to avoid the clash in most cases by using a more distinctive name ... Task-number: QTBUG-41706 Change-Id: Iaff1b6d37897fa8cf9e4913effa0498f9fd7bb07 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Doc: Use title case in section1 titlesNico Vertriest2014-09-309-20/+20
| | | | | | | | | | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Update license headers and add new license filesMatti Paaso2014-09-24139-2617/+1505
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* | Doc: corrected autolink errors qtbase/corelib/toolsNico Vertriest2014-09-248-20/+20
| | | | | | | | | | | | | | | | | | Also corrected some minor language/spelling issues Task-number: QTBUG-40362 Change-Id: I00d76521fc9beb4e7a4a83ff6dc3334a055a7148 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4Frederik Gladhorn2014-09-247-9/+46
|\ \
| * | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-237-9/+46
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| | * Correct QString::toStdString documentation on encodingJohn Brooks2014-09-051-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This statement was left from when toAscii was used, instead of toUtf8. There is no loss of information when converting to UTF-8. Change-Id: Iad92977af319b324cbf06f1a24712b31a7836622 Reviewed-by: Louai Al-Khanji <louai.al-khanji@digia.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Add missing private headers warningSamuel Gaist2014-09-043-0/+33
| | | | | | | | | | | | | | | Change-Id: I7a4dd22ea3bcebf4c3ec3ad731628fd8f3c247e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Fix several regressions in font selectionEskil Abrahamsen Blomfeldt2014-08-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5.3.0 a change was added which automatically adapts Common script to surrounding scripts in accordance with the Unicode tr#24. This broke *a lot* of cases of font selection because the font selection algorithm is not prepared for handling characters with adapted scripts. We need to disable this change for now and redo it later with patches to font selection to avoid the regressions. [ChangeLog][Text] Fixed several regressions in font selection when combining different writing systems in the same text. Task-number: QTBUG-39930 Task-number: QTBUG-39860 Change-Id: Id02b5ae2403c06542ed5d81e7c4deb2e0c7d816e Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| | * OS X - QCollator::compare() returns wrong results.Timur Pocheptsov2014-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | kUCCollateDigitsAsNumberMask works only if kUCCollateDigitsOverrideMask is also set. Update 0: - test added. Task-number: QTBUG-40777 Change-Id: I48bfec78f5f8439a51f8d749f0fc4397a72b29f2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| | * Fix QT_NO_REGULAREXPRESSION buildSérgio Martins2014-08-131-0/+4
| | | | | | | | | | | | | | | Change-Id: Ibf1358733d7c5aa2c14cf46c23a24ba4da14143c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QVersionNumber: correctly fail for numerically very large segmentsMarc Mutz2014-09-231-4/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The result of qstrtoull() was unconditionally truncated to an int, resulting in wrong values being appended to the segments vector when the numerical segment value was above INT_MAX. Prevent this by first checking the return value of qstrtoull as a qulonglong for values larger than INT_MAX and stopping processing in that case. That means that segments that numerically overflow an int are now considered part of the suffix. Also added tests for the case where a segment value is larger than ULLONG_MAX. That was already working correctly. Change-Id: Ia4b89021dcfe6bfae27c8d89bb678ec5e0e3b847 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix Windows ICU build break in QCollator after commit c17563ec.Michael Brüning2014-09-161-1/+1
| | | | | | | | | | | | | | | | It used LCID without including qt_windows.h while QT_USE_ICU was defined. Change-Id: I3d4cf0e6bd0e299729d23d9a36c5a87adde774c9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Speed up QStringList::removeDuplicates by ~2xDaniel Teske2014-09-151-2/+4
| | | | | | | | | | | | | | | | | | QSet::contains needs to hash the string, which is unnecessary, since we can just check if the size of the set changed. Change-Id: I2c7a42bae6cdf351533d5a582a42079658fa7729 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | Fix several issues in QCollatorLars Knoll2014-09-107-227/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the code and move more things into the cross platform code path. Make sure the flags survive changing the locale of QCollator. Use the correct locale on Windows, WinRT and OS X. We now pass all QCollator autotests on these platforms. Task-number: QTBUG-40778 Change-Id: Ic2d3334b5018c323a35a3ea8fc1d7ab5f99b4e62 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QDateTimeParser: remove unused local variablesMaks Naumov2014-09-051-2/+0
| | | | | | | | | | Change-Id: Id78fde8a720961c448d1aa3983ad296974796fdf Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Doc: QRect::isEmpty's documentation didn't match the code.David Faure2014-09-051-1/+1
| | | | | | | | | | | | | | | | | | The code says bool QRect::isValid() const { return x1 <= x2 && y1 <= y2; } so the documentation should say <= as well, rather than <. Change-Id: If52005879d2a758b5d1d64b552e6cd96341fae76 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Make QElapsedTimer default to invalid (and now non-POD).Robin Burchell2014-09-033-2/+22
| | | | | | | | | | | | | | | | | | | | | | The practical uses of a POD QElapsedTimer are not really that clear, and the number of misuses of this API are quite high. Default the state to invalid to prevent against mistakes. [ChangeLog][QtCore][QElapsedTimer] Is no longer a POD. Change-Id: I267292acf2bfca7404e3e449dd04410441d7ce26 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Micro-optimize QVector::count()Marc Mutz2014-08-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | ...by instantiating std::count() not with QVector::const_iterator, which is a class, but with const T*, thus increasing the chance that the instantiation can be shared with other instantiations in the executable. It might also enable STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types. Change-Id: I93df4e58f76838d98b565f229c19e317774b7b4c Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QList: check d for equality before d->size for inequalityMarc Mutz2014-08-281-2/+2
| | | | | | | | | | | | | | Same change as was already applied to QVector::operator==(). Change-Id: Ic2e140a52ee95f2e215668077951de0b4450d194 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QVector: check d for equality before d->size for inequalityMarc Mutz2014-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assuming the CPU has already loaded 'this', the value of 'd' is just an indirect load away. The value of d->size, however, is two indirect loads away, one of which is the load of 'd'. So it makes more sense to check for d-pointer equality first, as that can proceed in parallel with the fetch for d->size, which the CPU may speculatively trigger. In addition, at least GCC in release mode after this change doesn't set up the stack frame if the d-pointer check succeeds. Change-Id: I61f9b245070dd1742fca6ccb8d4936a0b1aa7c07 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Use std::vector range ctor in QVector::toStdVector()Marc Mutz2014-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three reasons to do so: 1. This could be more efficient, depending on the STL implementation. 2. By using QTypedArrayData iterators (T*) instead of QVector ones, we actually invoke the non-templated range ctor of std::vector, at least in the common case that std::vector<T>::const_iterator is also const T*. 3. The change turns a former NRVO return into a RVO one, potentially allowing more compilers to perform the copy elision. Change-Id: I70b35aaeae70ba06a971a36b8b1b1da997e8094f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-121-0/+88
|\| | | | | | | | | | | | | | | | | | | | | | | Manually included changes from 3a347a4e70e5a10ee92dd2578316c926a399e894 in src/opengl/qgl.cpp. Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/android/androidjnimain.cpp Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
| * Document missing QLatin1String methodsThiago Macieira2014-08-071-0/+88
| | | | | | | | | | | | | | Most of them were added before 5.0, but it's ok to just list as 5.0. Change-Id: I6e83a210a0165659f710d47ed595e9e89d5dbac9 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | QPair: add constexpr liberallyMarc Mutz2014-08-091-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On templates, adding constexpr makes a given instantiation constexpr if it can be. This turns qMakePair(0,0), say, into a compile-time constant. The effects on existing code are small, but exist: $ size lib/*{-baseline,-paircexp} | sort -nr 6516727 211192 2608 6730527 66b31f lib/libQt5Widgets.so.5.4.0-baseline 6516711 211192 2608 6730511 66b30f lib/libQt5Widgets.so.5.4.0-paircexp 5373720 44492 15976 5434188 52eb4c lib/libQt5Core.so.5.4.0-baseline 5373504 44492 15976 5433972 52ea74 lib/libQt5Core.so.5.4.0-paircexp 5107206 125072 6080 5238358 4fee56 lib/libQt5Gui.so.5.4.0-baseline 5107030 125072 6080 5238182 4feda6 lib/libQt5Gui.so.5.4.0-paircexp 1341290 30180 2600 1374070 14f776 lib/libQt5Network.so.5.4.0-baseline 1341210 30180 2600 1373990 14f726 lib/libQt5Network.so.5.4.0-paircexp # no other libraries benefit [ChangeLog][QtCore][QPair] Can now be used in C++11 constexpr contexts. Change-Id: I3872e6aa33a7d02a168516f4dfa7119efcac8c40 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | QStringRef: add missing \since 5.4Marc Mutz2014-08-091-0/+4
| | | | | | | | | | | | | | | | | | {,c}{begin,end}() were added post-5.3, in 1a6f490b, but weren't marked with \since 5.4. Add it. Change-Id: Ide743833144f784c7d09b125e7a22f9b184ed823 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Move the special QByteArrayList methods into QListThiago Macieira2014-08-094-267/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and make QByteArrayList be a simple typedef. As a side-effect, the constructor taking a QByteArray is no longer available since I couldn't find a way to add it to QList<T> when T is QByteArray. My template-foo failed me. I tried: - QEnableIf<is_same<T, QByteArray>::value, QByteArray>::type => makes QList fail to compile for any T that isn't QByteArray - make the constructor a template member => it compiles if the parameter is a QByteArray, but not a const char[4] like the test was - inheriting constructors => runs into ICC and Clang bugs that I could not work around Besides, the constructor with std::initializer_list is a superior solution anyway. Change-Id: Ic86fbadc1104142bfd907a5c4147199bf839fb89 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Long live QByteArrayList!Glen Mabey2014-08-093-0/+482
| | | | | | | | | | | | | | | | | | | | | | Initial submission of a new class QByteArrayList with the purpose of aggregating and then joining QByteArray instances. [ChangeLog][QtCore] Added new QByteArrayList class. Done-with: Marc Mutz <marc.mutz@kdab.com> Change-Id: I503af58f125d7f44fef10360177490c933e5840f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Long live QVersionNumber!Keith Gardner2014-08-093-2/+689
| | | | | | | | | | | | | | | | | | | | | | | | The class provides compare operators, stream operators, and hashing functions. This class aims to be compatible with (but not restricted to) the Semantic Versioning 2.0 standard (semver.org). [ChangeLog][QtCore] Added QVersionNumber class Done-with: Marc Mutz <marc.mutz@kdab.com> Change-Id: I244c8ccc002909af03987a2df052734d1a8621a9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | Add some missing STL typedefs and functions to QStringRef and QByteArrayThiago Macieira2014-08-084-0/+80
| | | | | | | | | | | | | | | | | | These will be needed in some template code that is to come. Change-Id: I5b93f4320313f7b15a6404de2c98f85485735fda Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Add missing #include <qdatastream.h> or <qiodevice.h>Thiago Macieira2014-08-074-0/+4
| | | | | | | | | | | | | | Lots of code depended on an indirect includes from qstringlist.h. Change-Id: I33d0dce33d64302d6c0e49180cc1249b90ab27c5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QCommandLineParser: support extremely concise option configuration in C++11Marc Mutz2014-08-064-2/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this commit to make the code in the test work: QCommandLineParser parser; parser.addOptions({ { "a", "The A option." }, { { "v", "verbose" }, "The verbose option." }, { { "i", "infile" }, "The input file.", "value" }, }); For this, QCommandLineParser needs a version of addOption that can take a list of options. That's what addOptions() is for. More importantly, the QCommandLineOption ctors mustn't be explicit. OTOH, any implicit conversion from QString or QStringList to QCommandLineOption is also undesirable. To solve this dilemma, add new QCommandLineOption ctors that just take one argument and are explicit, and make the existing ctors implicit. In order to avoid ambiguities, remove the default values of their resp. 2nd arguments. The new ctors are by intention not \since 5.4, as they are completely transparent to the user. Et voila, even better than getopt_long(3). [ChangeLog][QtCore][QCommandLineParser] Added addOptions() method. Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Implement QStringRef::splitJędrzej Nowacki2014-08-062-2/+38
| | | | | | | | | | | | | | [ChangeLog][QtCore] Added the QStringRef::split() function Change-Id: I28709c9761785dea7be4e7d621ecf4e1ae007a72 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove the last remnants of iWMMXt in QtThiago Macieira2014-08-052-39/+7
| | | | | | | | | | | | | | | | This code hasn't been tested for at least 4 years. It's not maintained and probably doesn't work. Change-Id: I4b9a5179e34111b400914f91caa6b741b69771bb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* | Doc: normalize the {to,from}WCharArray text about encodingsThiago Macieira2014-08-051-4/+4
| | | | | | | | | | | | | | | | | | | | Properly capitalize the names UTF-16 and UCS-4 and make sure we talk about UTF-16 and not UCS-2. UCS-2 is not the same and does not support surrogate pairs. Task-number: QTBUG-35287 Change-Id: If33270996bacc9ae5d04c87423fa1ee9ddaff230 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | Add a few missing Neon constructsThiago Macieira2014-08-051-7/+6
| | | | | | | | | | | | | | | | | | | | | | The #undef in qcompilerdetection.h was missing. And apparently we can detect Neon since Windows Mobile 6 too. Change-Id: I38a5f71b2704a29a706183e39f43db3a78a729db Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QList: Fix MSVC 64bit warning about loss of data.Friedemann Kleint2014-08-051-1/+1
| | | | | | | | | | | | | | | | qlist.h(133) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data qlist.h(131) : while compiling class template member function 'QList<QString>::QList(std::initializer_list<T>)' Change-Id: I8a11e298cd10da199490fbd8b269405a9e1cf5f3 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QList: add missing reserve() call in the initializer_list ctorMarc Mutz2014-08-031-1/+1
| | | | | | | | | | Change-Id: Idc46a347009556d06db4bc1f7ce3e2613fb1a405 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QTimeZone: optimize QTimeZonePrivate::isValidId()Marc Mutz2014-07-311-18/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is used in the named timezone ctor and was using QByteArray::split(), followed by size checks and a linear scan for invalid chars per section. The use of split() resulted in a lot of memory allocations and, unsurprisingly, bad performance. The new code just performs one linear scan through the byte array, calculating section sizes on the fly. Benchmark results (with the test data in tst_QTimeZone::isValidId_data()) show typical speedups of ~10x for valid IDs: RESULT : tst_QTimeZone::isValidId_bench():"minimal middle": - 0.00036 msecs per iteration (total: 95, iterations: 262144) + 0.000035 msecs per iteration (total: 74, iterations: 2097152) Even in the sweet-spot case of the old code---a space character anywhere in the string, checked for before the split---the new code is anywhere between slightly faster and not much slower: RESULT : tst_QTimeZone::isValidId_bench():"invalid char ' ' front": - 0.000011 msecs per iteration (total: 94, iterations: 8388608) + 0.000010 msecs per iteration (total: 86, iterations: 8388608) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ' ' middle": - 0.000014 msecs per iteration (total: 62, iterations: 4194304) + 0.000016 msecs per iteration (total: 69, iterations: 4194304) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ' ' back": - 0.000018 msecs per iteration (total: 79, iterations: 4194304) + 0.000023 msecs per iteration (total: 98, iterations: 4194304) This is not surprising, as the space character was singled out for a fast-exit check before. For any other invalid character, the new version is anywhere from 15x to 35x faster: RESULT : tst_QTimeZone::isValidId_bench():"invalid char ? front": - 0.00034 msecs per iteration (total: 91, iterations: 262144) + 0.000010 msecs per iteration (total: 87, iterations: 8388608) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ? middle": - 0.00036 msecs per iteration (total: 96, iterations: 262144) + 0.000016 msecs per iteration (total: 68, iterations: 4194304) RESULT : tst_QTimeZone::isValidId_bench():"invalid char ? back": - 0.00035 msecs per iteration (total: 94, iterations: 262144) + 0.000021 msecs per iteration (total: 92, iterations: 4194304) If there was a deeper reason to single out the space character, that fast-exit path can easily be restored. This function is often used in conjunction with availableTimeZoneIds(), which currently vastly dominates the runtime of the function calling both, but I'll add another optimization for the common use-case of just checking for a time-zone's existence in a subsequent commit. Change-Id: Ife1d096fcd39464083ea464c23e49ad98fabf345 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add ascii_isspace to replace the locale-dependent isspace(3)Thiago Macieira2014-07-313-10/+37
| | | | | | | | | | Change-Id: Icee42515179e6f3ddefe0692af69e90054449618 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add QString::splitRef functions.Jędrzej Nowacki2014-07-312-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | The functions can be used to optimize code that do not need to use the split results as QString directly. [ChangeLog][QtCore] QString can now split a string to a list of QStringRef. Change-Id: Ic2dc929e1fba82f9a060e37c51068a301cb5b866 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Use an enum to check that the OS is saving the register stateThiago Macieira2014-07-311-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | It's easier to read AVXState and AVX512State than 6 and 0xe6. Also add a note that where we should have checked whether the SSE state is being saved by the OS. However, we won't do it because it's just a waste of CPU cycles: any OS Qt 5 runs on will enable the proper state-saving. Change-Id: Id87b59fe1388a6cab983c9412341e36a86dd15c5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/devFrederik Gladhorn2014-07-301-1/+1
|\ \
| * | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-291-1/+1
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/network/ssl/qsslsocket_openssl_symbols.cpp Change-Id: Ic62419fa1fee5f4de6c372459d72e6e16f9a810b
| | * Use the stateless UTF-8 encoder in QStringRef::toUtf8Thiago Macieira2014-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | QString::toUtf8 already does it. I guess I forgot to update this part in d51130cc3a00df8147e2eb0799e06865c901c6e0. Change-Id: I83feafcb0383758f7e64d5142f57a7ae6a2ff351 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>