Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leandromoreira/lua-resty-perf
A small ngx resty lua library to benchmark memory and throughput of a function.
https://github.com/leandromoreira/lua-resty-perf
benchmark cpu lua luajit memory nginx openresty performance profiling
Last synced: 19 days ago
JSON representation
A small ngx resty lua library to benchmark memory and throughput of a function.
- Host: GitHub
- URL: https://github.com/leandromoreira/lua-resty-perf
- Owner: leandromoreira
- License: bsd-3-clause
- Created: 2021-04-13T00:38:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-03T02:29:03.000Z (over 3 years ago)
- Last Synced: 2024-02-17T13:33:53.999Z (9 months ago)
- Topics: benchmark, cpu, lua, luajit, memory, nginx, openresty, performance, profiling
- Language: Lua
- Homepage:
- Size: 47.9 KB
- Stars: 16
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Resty Perf
A simple resty lua library to benchmark memory and throughput of a function.
```lua
local function mycode()
local x = {}
for i = 1, 1e3 do
local now = ngx.now()
now = now - 45 + i
x[i] = now
end
return x
endperf.perf_time("mycode cpu profiling", mycode)
perf.perf_mem("mycode memory profiling", mycode)
```
To run it, you can use the openresty docker image:```bash
docker run -it --rm -v ${PWD}/test.lua:/test.lua -v ${PWD}/lib/resty/perf.lua:/lib/resty/perf.lua openresty/openresty:xenial resty /test.lua
```![perf command line result](example.jpg "A graph with experiments results")
# Installing
The module is available at [luarocks.](https://luarocks.org/modules/leandro/lua-resty-perf)
```bash
luarocks install lua-resty-perf
```