openresty / openresty/lua-nginx-module
development proposal: ngx.print with index parameters
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
Hi,
My proposal is related to the following API function:
ngx.print
syntax: ok, err = ngx.print(...)
We are using this function in conent_by_lua phase.
I would like to be able to print starting from an index x to index x+k without having to create a new string.
Today we are doing this by using lua string.sub() and this seems to create a performance hit according to our testing.
I am going to look at the code and see how this could be added.
Please let me know if you have any comment.
Best Regards
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the ngx.print entry point and its use in the content_by_lua phase; the issue names no file or test. Compare the proposed indexed output with the current Lua string.sub() approach, then establish the API details and verification needed to show the requested range works without creating a new string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua, nginx
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100