
, - , ++/Qt. / , , .
, Qt, ...
, ++/Qt , C++ . , , , «». , . E , , ++ , – . Qt , /C++.
, , Qt?..
, Qt – , Qt Group Plc. - , , , . , /.
- .
- Qt : «» LGPL 2. LGPL 2, , Qt , Qt . «» Qt ( , , Qt).
LGPL 3. LGPL 2 , Qt, , , . , «» ( , ) , Qt, Qt. .. – . , LGPL 3 – , ...
-, , , , LGPL 3 Qt.
… , Qt , (LGPL 3), (GPL) .
, , , . – $3950 (~300 . ) . , Qt, , // . Qt . , Qt .
, , .
Qt Group Plc , , LTS- ( ) Qt .

Qt. KDE Qt « », ( KDAB , , ).
, . , , , – .
, Qt , , , .
, . , Qt Group Plc , , Qt BSD, 12 .
– Qt Qt , , , / Qt . ? .
?
++ Qt? , . , , , , , – .
, , , , , /?..
, (: - - ). -- , . : 1) , , 2) , , .
( ) ( , 10 30 ), // .
( ) « », ( , ..) , , / .
, . /++ , . , , C , , C++. , , . ( , : , , , ).
- … , , , , , , -, , C/C++? , « » ? «» ?
Web-, . web- HTML, CSS JS, , //.
/ – , - WebView. , , ...
C HTML/CSS/JS , , , – , – .
, HTML/CSS/JS .
( ) . .

– PHP. , PHP. .
, : , , , C/C++, / . C- – . .
- – PHP . , ( ) — . . , , .
- PHP , , , 3 , , . Swoole.
- PHP FFI (foreign function interface) C. , — . «PHP: Basic FFI usage».
PHP $, ...- PHP . . : -. .
, Node.js Python, «Hello, world!» ( , , ). , , C/C++, .
, , — . « » PHP C++/Qt.
1 $5 , -. – nginx.
– PHP, , , . – , , . - , sha256 .
– , QtWebApp.
, Qt. - - node.js, - Swoole, , , , , Swoole node.js .
PHP<?php
$horse_name = htmlspecialchars($_GET['horse_name'], ENT_QUOTES, 'UTF-8');
$horse_hash = hash('sha256', $horse_name);
$database = new PDO("mysql:dbname=vacuum;host=127.0.0.1", 'user', 'password');
$database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = "SELECT `horse_color` FROM `horses` WHERE `horse_hash`=:horse_hash";
$statement = $database->prepare($query);
$statement->bindParam('horse_hash', $horse_hash);
$statement->execute();
$result = $statement->fetch(PDO::FETCH_ASSOC);
if ($result)
$horse_color = $result['horse_color'];
else
$horse_color = 'unknown';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Horse Color</title>
</head>
<body>
<p><?= $horse_name ?> color is <?= $horse_color ?>.</p>
</body>
</html>
QtWebAppvoid HorseHandler::service(HttpRequest& request, HttpResponse& response)
{
QSqlDatabase database = QSqlDatabase::addDatabase(
"QMYSQL", QString::number(
reinterpret_cast<uint64_t>(QThread::currentThreadId())));
database.setHostName("127.0.0.1");
database.setPort(3306);
database.setDatabaseName("vacuum");
database.setUserName("user");
database.setPassword("password");
database.open();
QString horseName =
QString(request.getParameter("horse_name")).toHtmlEscaped();
QByteArray horseHash =
QCryptographicHash::hash(horseName.toUtf8(), QCryptographicHash::Sha256)
.toHex();
QString queryString(
"SELECT `horse_color` FROM `horses` WHERE `horse_hash`=:horse_hash");
QSqlQuery query(database);
query.prepare(queryString);
query.bindValue(":horse_hash", horseHash);
query.exec();
QString horseColor;
if (query.next())
horseColor = query.value("horse_color").toString();
else
horseColor = "unknown";
QString templateString(R"RAW(<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Horse Color</title>
</head>
<body>
<p>{horse_name} color is {horse_color}.</p>
</body>
</html>)RAW");
Template horseColorTemplate(templateString, "horseColor");
horseColorTemplate.setVariable("horse_name", horseName);
horseColorTemplate.setVariable("horse_color", horseColor);
response.setHeader("Content-Type", "text/html; charset=UTF-8");
response.write(horseColorTemplate.toUtf8(), true);
}
, PHP .
ab -c 1 PHProot@horsesab:~# ab -n 1000 -c 1 http://x.x.x.x:8080/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking x.x.x.x (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.17.10
Server Hostname: x.x.x.x
Server Port: 8080
Document Path: /
Document Length: 155 bytes
Concurrency Level: 1
Time taken for tests: 1.125 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 302000 bytes
HTML transferred: 155000 bytes
Requests per second: 888.77 [#/sec] (mean)
Time per request: 1.125 [ms] (mean)
Time per request: 1.125 [ms] (mean, across all concurrent requests)
Transfer rate: 262.12 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 1 1 0.2 1 6
Waiting: 1 1 0.2 1 6
Total: 1 1 0.2 1 6
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 2
99% 2
100% 6 (longest request)
root@horsesab:~#
ab -c 1 QtWebApproot@horsesab:~# ab -n 1000 -c 1 http://x.x.x.x:8081/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking x.x.x.x (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.17.10
Server Hostname: x.x.x.x
Server Port: 8081
Document Path: /
Document Length: 155 bytes
Concurrency Level: 1
Time taken for tests: 1.848 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 323000 bytes
HTML transferred: 155000 bytes
Requests per second: 541.26 [#/sec] (mean)
Time per request: 1.848 [ms] (mean)
Time per request: 1.848 [ms] (mean, across all concurrent requests)
Transfer rate: 170.73 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 4
Processing: 1 2 0.3 2 7
Waiting: 1 2 0.3 1 7
Total: 1 2 0.4 2 7
ERROR: The median and mean for the waiting time are more than twice the standard
deviation apart. These results are NOT reliable.
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 2
80% 2
90% 2
95% 2
98% 2
99% 2
100% 7 (longest request)
root@horsesab:~#
ab -c 20 PHProot@horsesab:~# ab -n 1000 -c 20 http://x.x.x.x:8080/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking x.x.x.x (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.17.10
Server Hostname: x.x.x.x
Server Port: 8080
Document Path: /
Document Length: 155 bytes
Concurrency Level: 20
Time taken for tests: 0.664 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 302000 bytes
HTML transferred: 155000 bytes
Requests per second: 1505.59 [#/sec] (mean)
Time per request: 13.284 [ms] (mean)
Time per request: 0.664 [ms] (mean, across all concurrent requests)
Transfer rate: 444.03 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 6
Processing: 2 13 1.2 13 18
Waiting: 1 13 1.3 13 18
Total: 3 13 1.2 13 18
Percentage of the requests served within a certain time (ms)
50% 13
66% 13
75% 14
80% 14
90% 14
95% 15
98% 15
99% 16
100% 18 (longest request)
root@horsesab:~#
ab -c 20 QtWebApproot@horsesab:~# ab -n 1000 -c 20 http://x.x.x.x:8081/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking x.x.x.x (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.17.10
Server Hostname: x.x.x.x
Server Port: 8081
Document Path: /
Document Length: 155 bytes
Concurrency Level: 20
Time taken for tests: 1.716 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 323000 bytes
HTML transferred: 155000 bytes
Requests per second: 582.77 [#/sec] (mean)
Time per request: 34.319 [ms] (mean)
Time per request: 1.716 [ms] (mean, across all concurrent requests)
Transfer rate: 183.82 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 2
Processing: 4 34 13.3 34 188
Waiting: 2 34 13.3 34 188
Total: 4 34 13.3 34 188
Percentage of the requests served within a certain time (ms)
50% 34
66% 39
75% 41
80% 44
90% 49
95% 54
98% 60
99% 69
100% 188 (longest request)
root@horsesab:~#
— («») , . , , PHP, . . — , , .
«» , , , . «PHP -» — .
«» , , , (/++) . , , - « », « ++». -, , , SIMD- «» , , . 100500 «».
, . /PHP/C++ c , /, .. , , stackoverflow .
– Qt, - . , , , web-, .
: , , , . . Qt — ...