Skip to content

Commit 7efa480

Browse files
authored
Merge pull request #16 from TechEmpower/master
aa
2 parents a89d3d4 + 73a465c commit 7efa480

File tree

214 files changed

+9665
-2401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+9665
-2401
lines changed

frameworks/C++/cutelyst/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export CUTELYST_VER=3.1.0
77
apt update -qq && \
88
apt install -yqq --no-install-recommends \
99
cmake \
10+
git \
1011
pkg-config \
1112
qtbase5-dev \
1213
libqt5sql5-mysql \

frameworks/C++/cutelyst/src/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
cmake_minimum_required(VERSION 3.6.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
22

33
project(cutelyst_benchmarks LANGUAGES CXX)
44

55
cmake_policy(SET CMP0069 NEW)
66

7+
include(FetchContent)
8+
9+
FetchContent_Declare(
10+
mimalloc
11+
GIT_REPOSITORY https://github.com/microsoft/mimalloc.git
12+
GIT_TAG b3b0fb58326a96beea1f4872bc1489d1d9fda7e0 # v2.0.2
13+
)
14+
FetchContent_MakeAvailable(mimalloc)
15+
716
find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core Network Sql)
817
find_package(ASqlQt5 0.43.0 REQUIRED)
918
find_package(Cutelyst3Qt5 3.1 REQUIRED)
1019
find_package(Cutelee6Qt5 6.0.0 REQUIRED)
1120
find_package(PostgreSQL REQUIRED)
12-
find_package(mimalloc 1.0)
1321

1422
# Auto generate moc files
1523
set(CMAKE_AUTOMOC ON)
@@ -69,6 +77,7 @@ target_link_libraries(cutelyst-benchmarks
6977
Qt5::Network
7078
Qt5::Sql
7179
ASqlQt5::Core
80+
mimalloc
7281
)
7382
if (mimalloc_FOUND)
7483
target_link_libraries(cutelyst-benchmarks PUBLIC mimalloc)

frameworks/C++/cutelyst/src/fortunetest.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ void FortuneTest::fortunes_raw_p(Context *c)
2828
fortunes.reserve(result.size());
2929
auto it = result.begin();
3030
while (it != result.end()) {
31-
fortunes.push_back({it[0].toInt(), it[1].toString()});
31+
fortunes.emplace_back(Fortune{it[0].toInt(), it[1].toString()});
3232
++it;
3333
}
34-
fortunes.push_back({0, QStringLiteral("Additional fortune added at request time.")});
34+
fortunes.emplace_back(Fortune{0, QStringLiteral("Additional fortune added at request time.")});
3535

3636
std::sort(fortunes.begin(), fortunes.end(), [] (const Fortune &a1, const Fortune &a2) {
3737
return a1.message < a2.message;
@@ -160,24 +160,24 @@ FortuneList FortuneTest::processQuery(Context *c, QSqlQuery &query)
160160

161161
void FortuneTest::renderRaw(Context *c, const FortuneList &fortunes) const
162162
{
163-
QString out;
164-
out.append(QStringLiteral("<!DOCTYPE html>"
165-
"<html>"
166-
"<head><title>Fortunes</title></head>"
167-
"<body>"
168-
"<table>"
169-
"<tr><th>id</th><th>message</th></tr>"));
163+
QByteArray out;
164+
out.append("<!DOCTYPE html>"
165+
"<html>"
166+
"<head><title>Fortunes</title></head>"
167+
"<body>"
168+
"<table>"
169+
"<tr><th>id</th><th>message</th></tr>");
170170
out.reserve(4096);
171171

172172
for (const Fortune &fortune : fortunes) {
173-
out.append(QStringLiteral("<tr><td>"))
174-
.append(QString::number(fortune.id))
175-
.append(QStringLiteral("</td><td>"))
176-
.append(fortune.message.toHtmlEscaped())
177-
.append(QStringLiteral("</td></tr>"));
173+
out.append("<tr><td>")
174+
.append(QByteArray::number(fortune.id))
175+
.append("</td><td>")
176+
.append(fortune.message.toHtmlEscaped().toUtf8())
177+
.append("</td></tr>");
178178
}
179179

180-
out.append(QStringLiteral("</table></body></html>"));
180+
out.append("</table></body></html>");
181181

182182
auto response = c->response();
183183
response->setBody(out);

frameworks/C++/cutelyst/src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
#include "cutelyst-benchmarks.h"
3+
#include "mimalloc-new-delete.h"
34

45
#include <QCoreApplication>
56

0 commit comments

Comments
 (0)