Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Feb 21, 2024
2 parents 6c90e39 + 90877c0 commit 85b8d83
Show file tree
Hide file tree
Showing 117 changed files with 1,898 additions and 2,056 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: pr
Expand All @@ -20,7 +20,7 @@ jobs:
#
# We need to fetch more than one commit to be able to access HEAD^2 in case
# of a pull request
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 10
# In case of a push event, the commit we care about is simply HEAD.
Expand All @@ -46,7 +46,7 @@ jobs:
echo "$(git log --format=%B -n 1 HEAD^2)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "PREVIOUS_COMMIT=$(git log --format=%H -n 1 HEAD^2~1)" >> $GITHUB_ENV
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand Down Expand Up @@ -110,10 +110,10 @@ jobs:
PREVIOUS_COMMIT: ${{ needs.setup.outputs.previous_commit }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 10
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/get-maintainers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
get_maintainers:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Get commit branch and commit message from PR
Expand All @@ -19,7 +19,7 @@ jobs:
echo "$(git log --format=%B -n 1 HEAD^2)" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "PREVIOUS_COMMIT=$(git log --format=%H -n 1 HEAD^2~1)" >> $GITHUB_ENV
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
Expand All @@ -31,7 +31,7 @@ jobs:
run: |
python ./toolset/github_actions/get_maintainers.py > ./maintainers/maintainers.md
- name: Save Maintainers
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: maintainers
path: maintainers/
4 changes: 2 additions & 2 deletions .github/workflows/label-failing-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
uses: actions/github-script@v7
with:
# scripts lightly modified from https://securitylab.github.com/research/github-actions-preventing-pwn-requests
script: |
Expand All @@ -32,7 +32,7 @@ jobs:
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip
- name: Label PR
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ping-maintainers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: 'Download maintainers artifact'
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
Expand All @@ -32,7 +32,7 @@ jobs:
fs.writeFileSync('${{github.workspace}}/maintainers.zip', Buffer.from(download.data));
- run: unzip maintainers.zip
- name: Ping maintainers
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
4 changes: 2 additions & 2 deletions frameworks/C++/cinatra/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# cinatra Benchmarking Test

cinatra is a high-performance, easy-to-use http framework developed in Modern C++ (C++17) with the goal of making it easy and quick to develop web applications using the C++ programming language, located at https://github.com/qicosmos/cinatra
cinatra is a high-performance, easy-to-use http framework developed in Modern C++ (C++20) with the goal of making it easy and quick to develop web applications using the C++ programming language, located at https://github.com/qicosmos/cinatra

## Testing Source Code

* [PLAINTEXT](cinatra_benchmark/main.cpp)
* [PLAINTEXT](example/benchmark.cpp)

## Test URLs

Expand Down
42 changes: 22 additions & 20 deletions frameworks/C++/cinatra/benchmark_config.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"framework": "cinatra",
"tests": [{
"default": {
"plaintext_url": "/plaintext",
"port": 8090,
"approach": "Realistic",
"classification": "Fullstack",
"database": "None",
"framework": "cinatra",
"language": "C++",
"flavor": "None",
"orm": "None",
"platform": "None",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "cinatra",
"notes": "",
"versus": "cinatra"
"tests": [
{
"default": {
"plaintext_url": "/plaintext",
"port": 8090,
"approach": "Realistic",
"classification": "Fullstack",
"database": "None",
"framework": "cinatra",
"language": "C++",
"flavor": "None",
"orm": "None",
"platform": "None",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "cinatra",
"notes": "",
"versus": "cinatra"
}
}
}]
}
]
}
19 changes: 4 additions & 15 deletions frameworks/C++/cinatra/cinatra.dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
FROM ubuntu:18.04
FROM ubuntu:22.04
RUN apt-get update -yqq && \
apt-get install -yqq cmake git uuid-dev gcc g++ autoconf
ENV ASIO=/asio
ENV ASIO_INTERNAL=/asio/asio
ENV CINATRA=/cinatra
ENV CINATRA_EXAMPLE=/cinatra/example
WORKDIR /
RUN git clone https://github.com/chriskohlhoff/asio.git
WORKDIR $ASIO
RUN git checkout 8087252a0c3c2f0baad96ddbd6554db17a846376
WORKDIR $ASIO_INTERNAL
RUN ./autogen.sh && ./configure
RUN make && make install
WORKDIR /
RUN git clone https://github.com/qicosmos/cinatra.git
WORKDIR $CINATRA
RUN git checkout 5acb35cd72c3f72512c0a55e7dea9e25d7779039
WORKDIR $CINATRA_EXAMPLE
RUN mkdir build && cd build && cmake .. && make
RUN git checkout c9bec308e27174c8b7f0f01c92652509f7b47253
RUN mkdir build && cd build && cmake .. && make -j
EXPOSE 8090
CMD ./build/cinatra_example
CMD ./build/example/benchmark
57 changes: 3 additions & 54 deletions frameworks/C++/cinatra/cinatra_benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,10 @@ include_directories($ENV{CINATRA_HOME})
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -pthread -msse4.2 -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -pthread -std=c++20")
endif ()

SET(ENABLE_GZIP OFF)
SET(ENABLE_SSL OFF)
SET(ENABLE_CLIENT_SSL OFF)
SET(ENABLE_ASIO_STANDALONE ON)
add_executable(cinatra_example main.cpp)
target_compile_definitions(cinatra_example PRIVATE ASYNC_SIMPLE_HAS_NOT_AIO)

if (ENABLE_SSL)
add_definitions(-DCINATRA_ENABLE_SSL)
message(STATUS "Use SSL")
endif()

if(ENABLE_GZIP)
add_definitions(-DCINATRA_ENABLE_GZIP)
endif()

if(ENABLE_CLIENT_SSL)
add_definitions(-DCINATRA_ENABLE_CLIENT_SSL)
endif()

if(ENABLE_ASIO_STANDALONE)
add_definitions(-DASIO_STANDALONE)
else()
find_package(Boost 1.60 REQUIRED COMPONENTS system)
endif()

if (ENABLE_SSL)
find_package(OpenSSL REQUIRED)
endif()
if (ENABLE_CLIENT_SSL)
find_package(OpenSSL REQUIRED)
endif()

if (ENABLE_GZIP)
find_package(ZLIB REQUIRED)
endif()

set(CINATRA_EXAMPLE
main.cpp
)

add_executable(${project_name} ${CINATRA_EXAMPLE})
include_directories(${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})

target_link_libraries(${project_name} ${Boost_LIBRARIES} uuid -lstdc++fs)
if (ENABLE_SSL)
target_link_libraries(${project_name} ${OPENSSL_LIBRARIES} pthread -ldl)
endif()

if (ENABLE_CLIENT_SSL)
target_link_libraries(${project_name} ${OPENSSL_LIBRARIES} pthread -ldl)
endif()

if (ENABLE_GZIP)
target_link_libraries(${project_name} ${ZLIB_LIBRARIES})
endif()
install(TARGETS ${project_name} DESTINATION include)
24 changes: 9 additions & 15 deletions frameworks/C++/cinatra/cinatra_benchmark/main.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#include <iostream>
#include <include/cinatra.hpp>
#include <iostream>

using namespace cinatra;
using namespace std::chrono_literals;

int main() {
http_server server(std::thread::hardware_concurrency());
bool r = server.listen("0.0.0.0", "8090");
if (!r) {
std::cout << "listen failed\n";
return -1;
}

server.enable_timeout(false);
server.set_http_handler<GET>("/plaintext", [](request& req, response& res) {
res.set_status_and_content<status_type::ok,res_content_type::string>("Hello, World!");
});

server.run();
return 0;
coro_http_server server(std::thread::hardware_concurrency(), 8090);
server.set_http_handler<GET>(
"/plaintext", [](coro_http_request &req, coro_http_response &resp) {
resp.need_date_head(false);
resp.set_status_and_content(status_type::ok, "Hello, world!");
});
server.sync_start();
}
11 changes: 3 additions & 8 deletions frameworks/C++/treefrog/models/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ World &World::operator=(const World &other)

bool World::update()
{
TSqlQueryORMapper<WorldObject> mapper;
mapper.prepare(QStringLiteral("UPDATE world SET randomNumber=? WHERE id=?"));
mapper.addBind(randomNumber()).addBind(id());
return mapper.exec();
return TAbstractModel::update();
}

World World::create(int randomNumber)
Expand All @@ -74,10 +71,8 @@ World World::create(const QVariantMap &values)

World World::get(uint id)
{
TSqlQueryORMapper<WorldObject> mapper;
mapper.prepare(QStringLiteral("SELECT * from world WHERE id=?"));
mapper.addBind(id);
return World(mapper.execFirst());
TSqlORMapper<WorldObject> mapper;
return World(mapper.findByPrimaryKey(id));
}

int World::count()
Expand Down
2 changes: 1 addition & 1 deletion frameworks/C++/treefrog/treefrog-epoll.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM buildpack-deps:jammy

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS yes
ENV TFVER=2.7.1
ENV TFVER=2.8.0

RUN apt-get update -yqq && apt-get upgrade -yq && \
apt-get install -yqq --no-install-recommends software-properties-common unzip wget libjemalloc-dev \
Expand Down
2 changes: 1 addition & 1 deletion frameworks/C++/treefrog/treefrog-mongodb.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM buildpack-deps:jammy

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS yes
ENV TFVER=2.7.1
ENV TFVER=2.8.0

RUN apt-get update -yqq && apt-get upgrade -yq && \
apt-get install -yqq --no-install-recommends software-properties-common unzip wget libjemalloc-dev \
Expand Down
2 changes: 1 addition & 1 deletion frameworks/C++/treefrog/treefrog-mysql.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM buildpack-deps:jammy

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS yes
ENV TFVER=2.7.1
ENV TFVER=2.8.0

RUN apt-get update -yqq && apt-get upgrade -yq && \
apt-get install -yqq --no-install-recommends software-properties-common unzip wget libjemalloc-dev \
Expand Down
2 changes: 1 addition & 1 deletion frameworks/C++/treefrog/treefrog.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM buildpack-deps:jammy

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS yes
ENV TFVER=2.7.1
ENV TFVER=2.8.0

RUN apt-get update -yqq && apt-get upgrade -yq && \
apt-get install -yqq --no-install-recommends software-properties-common unzip wget libjemalloc-dev \
Expand Down
5 changes: 3 additions & 2 deletions frameworks/C++/userver/userver-bare.dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM ghcr.io/userver-framework/ubuntu-userver-build-base:v1 AS builder
FROM ghcr.io/userver-framework/ubuntu-userver-build-base:v2 AS builder

RUN apt update && \
apt install -y lsb-release wget software-properties-common gnupg && \
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 16

WORKDIR /src
RUN git clone https://github.com/userver-framework/userver.git && \
cd userver && git checkout b85d540d7022e344f6fcf9fd467c67b046c961fe
cd userver && git checkout fcf0514be560f46740f8a654f2fdce5dc1cd450c

COPY userver_benchmark/ ./
RUN mkdir build && cd build && \
cmake -DUSERVER_IS_THE_ROOT_PROJECT=0 -DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 \
Expand Down
5 changes: 3 additions & 2 deletions frameworks/C++/userver/userver.dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM ghcr.io/userver-framework/ubuntu-userver-build-base:v1 AS builder
FROM ghcr.io/userver-framework/ubuntu-userver-build-base:v2 AS builder

RUN apt update && \
apt install -y lsb-release wget software-properties-common gnupg && \
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 16

WORKDIR /src
RUN git clone https://github.com/userver-framework/userver.git && \
cd userver && git checkout b85d540d7022e344f6fcf9fd467c67b046c961fe
cd userver && git checkout fcf0514be560f46740f8a654f2fdce5dc1cd450c

COPY userver_benchmark/ ./
RUN mkdir build && cd build && \
cmake -DUSERVER_IS_THE_ROOT_PROJECT=0 -DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 \
Expand Down
Loading

0 comments on commit 85b8d83

Please sign in to comment.