-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: regex pattern in variables (#36)
- Loading branch information
Showing
21 changed files
with
538 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
unused_args = false | ||
max_line_length = false | ||
redefined = false | ||
|
||
globals = { | ||
"ngx", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local Router = require "radix-router" | ||
local utils = require "benchmark.utils" | ||
|
||
local route_n = os.getenv("RADIX_ROUTER_ROUTES") or 1000 * 100 | ||
local times = os.getenv("RADIX_ROUTER_TIMES") or 1000 * 1000 * 10 | ||
|
||
local router | ||
do | ||
local routes = {} | ||
for i = 1, route_n do | ||
routes[i] = { paths = { string.format("/%d/{name:[^/]+}", i) }, handler = i } | ||
end | ||
router = Router.new(routes) | ||
end | ||
|
||
local rss_mb = utils.get_rss() | ||
|
||
local path = "/1/a" | ||
local elapsed = utils.timing(function() | ||
for _ = 1, times do | ||
router:match(path) | ||
end | ||
end) | ||
|
||
utils.print_result({ | ||
title = "regex", | ||
routes = route_n, | ||
times = times, | ||
elapsed = elapsed, | ||
benchmark_path = path, | ||
benchmark_handler = router:match(path), | ||
rss = rss_mb, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env resty | ||
|
||
if ngx ~= nil then | ||
ngx.exit = function()end | ||
end | ||
|
||
require 'busted.runner'({ standalone = false }) |
Oops, something went wrong.