File tree Expand file tree Collapse file tree 6 files changed +14388
-0
lines changed Expand file tree Collapse file tree 6 files changed +14388
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ test/test.xcodeproj/*/xcuser*
2121test /* .o
2222test /* .pem
2323test /* .srl
24+ benchmark /server
25+ benchmark /server-crow
2426
2527* .swp
2628
@@ -34,6 +36,7 @@ Release
3436* .db
3537ipch
3638* .dSYM
39+ * .pyc
3740. *
3841! /.gitattributes
3942! /.travis.yml
Original file line number Diff line number Diff line change 1+ CXXFLAGS = -std=c++14 -O2 -I..
2+
3+ THEAD_POOL_COUNT = 16
4+ BENCH_FLAGS = -c 8 -d 5s
5+
6+ # cpp-httplib
7+ bench : server
8+ @./server & export PID=$$ ! ; bombardier $(BENCH_FLAGS ) localhost:8080; kill $$ {PID}
9+
10+ server : cpp-httplib/main.cpp ../httplib.h
11+ g++ -o $@ $(CXXFLAGS ) -DCPPHTTPLIB_THREAD_POOL_COUNT=$(THEAD_POOL_COUNT ) cpp-httplib/main.cpp
12+
13+ run : server
14+ @./server
15+
16+ # crow
17+ server-crow : crow/main.cpp
18+ g++ -o $@ $(CXXFLAGS ) crow/main.cpp
19+
20+ bench-crow : server-crow
21+ @./server-crow & export PID=$$ ! ; bombardier $(BENCH_FLAGS ) localhost:8080; kill $$ {PID}
22+
23+ # flask
24+ bench-flask :
25+ @FLASK_APP=flask/main.py flask run --port=8080 & export PID=$$ ! ; bombardier $(BENCH_FLAGS ) localhost:8080; kill $$ {PID}
26+
27+ # misc
28+ bench-all : bench bench-crow bench-flask
29+
30+ clean :
31+ rm -rf server*
Original file line number Diff line number Diff line change 1+ #include " httplib.h"
2+ using namespace httplib ;
3+
4+ int main () {
5+ Server svr;
6+
7+ svr.Get (" /" , [](const Request &, Response &res) {
8+ res.set_content (" Hello World!" , " text/plain" );
9+ });
10+
11+ svr.listen (" 0.0.0.0" , 8080 );
12+ }
You can’t perform that action at this time.
0 commit comments