Skip to content

Commit 3c06fd9

Browse files
committed
doc: deleted some not useful benchmark code.
1 parent ed6ea1a commit 3c06fd9

1 file changed

Lines changed: 1 addition & 40 deletions

File tree

README.md

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,7 @@ lua-var-nginx-module
33

44
Fetchs Nginx variable by Luajit with FFI way which is fast and cheap.
55

6-
```lua
7-
local function test1()
8-
local start_time = ngx.now()
9-
10-
local var = ngx.var
11-
local uri
12-
for i = 1, 10000 * 1000 do
13-
uri = var.uri
14-
if not uri then
15-
uri = uri .. "xxx"
16-
end
17-
end
18-
19-
ngx.update_time()
20-
ngx.say("ngx.var directly, used time: ", ngx.now() - start_time)
21-
end
22-
23-
local function test2()
24-
local start_time = ngx.now()
25-
26-
local ngxvar = require("resty.ngxvar").fetch
27-
local req = ngxvar("_request")
28-
local uri
29-
30-
for i = 1, 10000 * 1000 do
31-
uri = ngxvar("uri", req)
32-
if not uri then
33-
uri = uri .. "xxx"
34-
end
35-
end
36-
37-
ngx.update_time()
38-
ngx.say("ngxvar patch, used time: ", ngx.now() - start_time)
39-
end
40-
41-
test1() -- ngx.var directly, used time: 0.49900007247925
42-
test2() -- fetch with ngxvar, used time: 0.08299994468689
43-
```
44-
45-
Compares to `ngx.var`, performance has increased by more than five times. ^_^
6+
Compares to `ngx.var.*`, performance has increased by more than five times. ^_^
467

478

489
Table of Contents

0 commit comments

Comments
 (0)