Skip to content

Commit e394d3f

Browse files
authored
doc(benchmark): prepare 1000 * 10 routes for benchmark. (#57)
1 parent d021d86 commit e394d3f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,23 +248,23 @@ resty -I=./lib -I=./deps/share/lua/5.1 benchmark/match-parameter.lua
248248
matched res: 1
249249
route count: 100000
250250
match times: 1000000
251-
time used : 0.51699995994568 sec
252-
QPS : 1934236
253-
each time : 0.51699995994568 ns
251+
time used : 1.1389999389648 sec
252+
QPS : 877963
253+
each time : 1.1389999389648 ns
254254

255255
resty -I=./lib -I=./deps/share/lua/5.1 benchmark/match-prefix.lua
256256
matched res: 500
257257
route count: 100000
258258
match times: 1000000
259-
time used : 0.625 sec
260-
QPS : 1600000
259+
time used : 0.54299998283386 sec
260+
QPS : 1841620
261261

262262
resty -I=./lib -I=./deps/share/lua/5.1 benchmark/match-static.lua
263263
matched res: 500
264264
route count: 100000
265265
match times: 1000000
266-
time used : 0.10099983215332 sec
267-
QPS : 9901006
266+
time used : 0.10500001907349 sec
267+
QPS : 9523807
268268
```
269269

270270
[Back to TOC](#table-of-contents)

benchmark/match-parameter.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ local route_count = 1000 * 100
33
local match_times = 1000 * 1000
44

55
local routes = {}
6-
for i = 1, 1 do
7-
routes[i] = {paths = {"/user/:name"}, metadata = i}
6+
for i = 1, route_count do
7+
routes[i] = {paths = {"/user" .. i .. "/:name"}, metadata = i}
88
end
99

1010
local rx = radix.new(routes)
@@ -13,7 +13,7 @@ ngx.update_time()
1313
local start_time = ngx.now()
1414

1515
local res
16-
local path = "/user/gordon"
16+
local path = "/user1/gordon"
1717
for _ = 1, match_times do
1818
res = rx:match(path)
1919
end

0 commit comments

Comments
 (0)