I'm planning to use liquid templating in OpenResty during request phase.
That means we will be applying series of optimizations to this project to reduce GC pressure and make the code JITable.
Some of the changes might be non idiomatic, but will be needed for sake of performance.
Main concerns are:
replace use of pairs (fortunately just 2) with ipairs
cache all global functions like string.find in local variables (str:find('foo') to local find = string.find; find(str, 'foo'))
reduce table allocations (cache the metatables in :new functions)
That is just from top of my head. Guess I'll find more when actually profiling it.
I'd like to know if you would like these changes to be applied to your project or we should just maintain a fork. I'm not sure what your commitment is to this project, but ours is quite serious as it is used for templating in our API Gateway: 3scale/APIcast.
I'd be happy if we could have just one project instead of forking, but there are some issues opened for a long time: https://github.com/chenxianyu2015/liquid-lua/pull/13https://github.com/chenxianyu2015/liquid-lua/issues/14 and we simply have to move fast.
I'm planning to use liquid templating in OpenResty during request phase.
That means we will be applying series of optimizations to this project to reduce GC pressure and make the code JITable.
Some of the changes might be non idiomatic, but will be needed for sake of performance.
Main concerns are:
pairs
(fortunately just 2) withipairs
string.find
in local variables (str:find('foo')
tolocal find = string.find; find(str, 'foo')
):new
functions)That is just from top of my head. Guess I'll find more when actually profiling it.
I'd like to know if you would like these changes to be applied to your project or we should just maintain a fork. I'm not sure what your commitment is to this project, but ours is quite serious as it is used for templating in our API Gateway: 3scale/APIcast. I'd be happy if we could have just one project instead of forking, but there are some issues opened for a long time: https://github.com/chenxianyu2015/liquid-lua/pull/13 https://github.com/chenxianyu2015/liquid-lua/issues/14 and we simply have to move fast.