From 29b18a017968cbc79dfcd21ea1622de823dc1596 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 18 Feb 2022 09:01:08 +0100 Subject: QSettings: overload value() instead of using a default argument ... of non-trivial type, which needs to be constructed every time the function is called, no matter whether the user supplies one or not. Effects on Linux AMD64 O2 C++20 tst_qsettings builds, as an example heavy-duty QSettings::value() user: GCC 11.2 libstdc++ (TEXT -= 4.6%): text data bss dec hex filename 662317 10952 2824 676093 a50fd tst_qsettings-00-baseline 631849 10960 2824 645633 9da01 tst_qsettings-01-qvariant Clang 10.0.0 libc++ (TEXT -= 2.8%) text data bss dec hex filename 808448 10616 2832 821896 c8a88 tst_qsettings-00-baseline 785890 10624 2832 799346 c3272 tst_qsettings-01-qvariant Pick-to: 6.3 Task-number: QTBUG-98117 Change-Id: I7366f063e3ec34c040fd35ffd274e8ed5a722132 Reviewed-by: Kai Koehne Reviewed-by: Qt CI Bot --- src/corelib/io/qsettings_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/io/qsettings_p.h') diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index ddcbe0f76c..4849975f2a 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -208,6 +208,7 @@ public: virtual bool isWritable() const = 0; virtual QString fileName() const = 0; + QVariant value(const QString &key, const QVariant *defaultValue) const; QString actualKey(const QString &key) const; void beginGroupOrArray(const QSettingsGroup &group); void setStatus(QSettings::Status status) const; -- cgit v1.2.3