Skip to content

Commit

Permalink
bench: add a simple variable benchmark with 1000000 routes
Browse files Browse the repository at this point in the history
  • Loading branch information
vm-001 committed Jan 1, 2024
1 parent f9fcbba commit bf9a5de
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test-coverage:
bench:
RADIX_ROUTER_ROUTES=100000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/static-paths.lua
RADIX_ROUTER_ROUTES=100000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-variable.lua
RADIX_ROUTER_ROUTES=1000000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-variable.lua
RADIX_ROUTER_ROUTES=100000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-prefix.lua
RADIX_ROUTER_ROUTES=100000 RADIX_ROUTER_TIMES=1000000 luajit benchmark/complex-variable.lua
RADIX_ROUTER_ROUTES=100000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-variable-binding.lua
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ $ make bench
#### Results

| TEST CASE | Router number | nanoseconds / op | QPS | RSS |
| ----------------------- | ------------- |------------------|------------|--------------|
| ----------------------- |---------------|------------------|------------|--------------|
| static path | 100000 | 0.0129826 | 77,026,173 | 65.25 MB |
| simple variable | 100000 | 0.0802077 | 12,467,630 | 147.52 MB |
| simple variable | 1000000 | 0.084604 | 11,819,772 | 1381.47 MB |
| simple prefix | 100000 | 0.0713651 | 14,012,451 | 147.47 MB |
| complex variable | 100000 | 0.914117 | 1,093,951 | 180.30 MB |
| simple variable binding | 100000 | 0.21054 | 4,749,691 | 147.28 MB |
Expand Down Expand Up @@ -179,6 +180,17 @@ path : /1/foo
handler : 1
Memory : 147.52 MB
RADIX_ROUTER_ROUTES=1000000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-variable.lua
========== variable ==========
routes : 1000000
times : 10000000
elapsed : 0.84604 s
QPS : 11819772
ns/op : 0.084604 ns
path : /1/foo
handler : 1
Memory : 1381.47 MB
RADIX_ROUTER_ROUTES=100000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-prefix.lua
========== prefix ==========
routes : 100000
Expand Down
12 changes: 12 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ $ make bench
| ----------------------- | ------------- |------------------|------------|--------------|
| static path | 100000 | 0.0129826 | 77,026,173 | 65.25 MB |
| simple variable | 100000 | 0.0802077 | 12,467,630 | 147.52 MB |
| simple variable | 1000000 | 0.084604 | 11,819,772 | 1381.47 MB |
| simple prefix | 100000 | 0.0713651 | 14,012,451 | 147.47 MB |
| complex variable | 100000 | 0.914117 | 1,093,951 | 180.30 MB |
| simple variable binding | 100000 | 0.21054 | 4,749,691 | 147.28 MB |
Expand Down Expand Up @@ -186,6 +187,17 @@ path : /1/foo
handler : 1
Memory : 147.52 MB
RADIX_ROUTER_ROUTES=1000000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-variable.lua
========== variable ==========
routes : 1000000
times : 10000000
elapsed : 0.84604 s
QPS : 11819772
ns/op : 0.084604 ns
path : /1/foo
handler : 1
Memory : 1381.47 MB
RADIX_ROUTER_ROUTES=100000 RADIX_ROUTER_TIMES=10000000 luajit benchmark/simple-prefix.lua
========== prefix ==========
routes : 100000
Expand Down

0 comments on commit bf9a5de

Please sign in to comment.