Skip to content

Commit

Permalink
greatly optimized PCH
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed May 22, 2024
1 parent 1f34fcd commit 355008b
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 110 deletions.
14 changes: 14 additions & 0 deletions NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3259,3 +3259,17 @@ All this isn't enough as you need the correct libmysql.dll and openssl 1 librari
these libaries to my dotfiles at bin_qt5.
To use these libraries prepend this path to the Qt v5.15 KIT Environment:
PATH=+E:\dotfiles\bin_qt5;


Optimize PCH #include-s:
------------------------

- search all system #include-s in all hpp and cpp files and paste them to the pch.h
- remove duplicate #include-s eg. <QStringList> already includes <QString> or <QDir> already includes <QFile>
- add also our TinyORM headers that are included eg. in TinyDrivers/MySql as system headers!
- then change RegEx to search all #include-s in #ifdef, changed '# *...' to '# +include <.*>'
- and mirror these #ifdef-s in pch.h

Get-ChildItem -Recurse .\include\orm\*.hpp,.\src\orm\*.cpp | Select-String -Pattern '# *include <.*>' -Raw | ForEach-Object { $_ -creplace '(?:# *|(>) *// *(.*)$)', '$1' } | Sort-Object -Unique -CaseSensitive
Get-ChildItem -Recurse .\drivers\common\*.hpp,.\drivers\common\*.cpp | Select-String -Pattern '# +include <.*>' -Raw | ForEach-Object { $_ -creplace '(?:# *|(>) *// *(.*)$)', '$1' } | Sort-Object -Unique -CaseSensitive
Get-ChildItem -Recurse .\drivers\mysql\*.hpp,.\drivers\mysql\*.cpp | Select-String -Pattern '# +include <.*>' -Raw | ForEach-Object { $_ -creplace '(?:# *|(>) *// *(.*)$)', '$1' } | Sort-Object -Unique -CaseSensitive
66 changes: 28 additions & 38 deletions drivers/common/include/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,36 @@

/* Add C includes here */

#if defined __cplusplus
#ifdef __cplusplus
/* Add C++ includes here */
#include <QDateTime>
#include <QDebug>
//#include <QHash>
//#include <QMap>
#include <QStringList>
#include <QTimeZone>
//#include <QTimer>
#include <QDir>
#include <QElapsedTimer>
#include <QLibrary>
#include <QRegularExpression>
#include <QUuid>
#include <QVariant>
//#include <QVector>
#include <QVersionNumber>

#include <algorithm>
#include <array>
//#include <bitset>
//#include <cassert>
//#include <cfloat>
//#include <cmath>
//#include <complex>
//#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <initializer_list>
#include <iterator>
//#include <map>
#include <memory>
#include <mutex>
#include <numeric>
#include <optional>
//#include <set>
//#include <span>
//#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
//#include <unordered_set>
#include <vector>
#ifndef QT_NO_DEBUG_STREAM
# include <QDebug>
#endif
#ifdef _WIN32
# include <qt_windows.h>
#endif

#include <shared_mutex>

#ifdef __linux__
# include <dlfcn.h>
#endif

#include <orm/macros/archdetect.hpp>
#include <orm/macros/commonnamespace.hpp>
#include <orm/macros/compilerdetect.hpp>
#include <orm/macros/export_common.hpp>
#include <orm/macros/likely.hpp>
#include <orm/macros/stringify.hpp>
#include <orm/macros/systemheader.hpp>
#include <orm/support/replacebindings.hpp>
#endif
44 changes: 6 additions & 38 deletions drivers/mysql/include/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,14 @@

/* Add C includes here */

#if defined __cplusplus
#ifdef __cplusplus
/* Add C++ includes here */
#include <QDateTime>
//#include <QDebug>
//#include <QHash>
//#include <QMap>
#include <QStringList>
//#include <QTimeZone>
//#include <QTimer>
#include <QVariant>
//#include <QVector>

#include <algorithm>
#include <array>
//#include <bitset>
//#include <cassert>
//#include <cfloat>
//#include <cmath>
//#include <complex>
//#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
//#include <functional>
#include <initializer_list>
#include <iterator>
//#include <map>
#include <memory>
//#include <mutex>
#include <numeric>
#include <optional>
//#include <set>
//#include <span>
//#include <string>
//#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
//#include <unordered_set>
#include <vector>

#include <orm/macros/commonnamespace.hpp>
#include <orm/macros/likely.hpp>
#include <orm/macros/stringify.hpp>
#include <orm/macros/systemheader.hpp>
#endif
83 changes: 49 additions & 34 deletions include/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,58 @@
#ifdef __cplusplus
/* Add C++ includes here */
#include <QDateTime>
#include <QDebug>
#include <QHash>
#include <QMap>
#include <QStringList>
#include <QDir>
#include <QElapsedTimer>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QRegularExpression>
#include <QSet>
#include <QTimeZone>
#include <QTimer>
#include <QVariant>
#include <QVector>
#include <QtSql/QSqlError>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlRecord>
#include <QVariantHash>
#include <QVersionNumber>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <complex>
#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <map>
#include <memory>
#include <mutex>
#include <numeric>
#ifndef QT_NO_DEBUG_STREAM
# include <QDebug>
#endif
#ifdef _WIN32
# include <qt_windows.h>
#endif

#include <fstream>
#include <optional>
#include <set>
#include <span>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <stack>
#include <unordered_set>
#include <vector>

#ifdef __GNUG__
# include <cxxabi.h>
#endif
#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
# include <sys/prctl.h>
#endif

#include <range/v3/action/erase.hpp>
#include <range/v3/action/remove_if.hpp>
#include <range/v3/action/sort.hpp>
#include <range/v3/action/transform.hpp>
#include <range/v3/action/unique.hpp>
#include <range/v3/algorithm/contains.hpp>
#include <range/v3/algorithm/set_algorithm.hpp>
#include <range/v3/algorithm/stable_sort.hpp>
#include <range/v3/algorithm/unique.hpp>
#include <range/v3/iterator/insert_iterators.hpp>
#include <range/v3/numeric/accumulate.hpp>
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/filter.hpp>
#include <range/v3/view/map.hpp>
#include <range/v3/view/move.hpp>
#include <range/v3/view/remove_if.hpp>
#include <range/v3/view/reverse.hpp>
#include <range/v3/view/set_algorithm.hpp>
#include <range/v3/view/transform.hpp>
#endif

0 comments on commit 355008b

Please sign in to comment.