mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
589 B
35 lines
589 B
|
|
local function target()
|
|
ngx.re.find("hello, world.", [[\w+\.]], "jo")
|
|
end
|
|
for i = 1, 100 do
|
|
target()
|
|
end
|
|
-- 以上为预热操作
|
|
collectgarbage()
|
|
|
|
local spider_match = "aa 220"
|
|
|
|
|
|
ngx.update_time()
|
|
local begin = ngx.now()
|
|
local N = 1e7
|
|
for i = 1, N do
|
|
ngx.re.find(spider_match, "360", "ijo")
|
|
end
|
|
ngx.update_time()
|
|
|
|
ngx.say("ngx.re.find elapsed: ", (ngx.now() - begin) / N)
|
|
|
|
|
|
|
|
ngx.update_time()
|
|
local begin = ngx.now()
|
|
local N = 1e7
|
|
for i = 1, N do
|
|
string.find(spider_match, "360", 1, true)
|
|
end
|
|
ngx.update_time()
|
|
|
|
ngx.say("string.find elapsed: ", (ngx.now() - begin) / N)
|
|
|
|
|