Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster rendering #7

Merged
merged 3 commits into from
Mar 4, 2016
Merged

Faster rendering #7

merged 3 commits into from
Mar 4, 2016

Conversation

FSMaxB
Copy link
Owner

@FSMaxB FSMaxB commented Mar 4, 2016

I still have to do benchmarks, but I'm quite confident, that the performance of rendering can be improved by not switching between coroutines all the time.

This pull request will replace coroutine.yield with table.insert when rendering with liluat.render. For liluat.render_coroutine, everything stays the same.

This uses "__liluat_output_function" instead of "coroutine.yield", this
means that the function used as output function can be specified at
render time instead of compile time, therefore allowing to render the
same template in different ways.
@FSMaxB
Copy link
Owner Author

FSMaxB commented Mar 4, 2016

I'm gonna be doing benchmarks for every commit:

#!/usr/bin/env lua
local liluat = loadfile("liluat.lua")()

local template = [[
{{ for i = 0, 10000000 do}}
    {{= i}}
{{ end }}
]]

local code = liluat.compile(template)

local rendered = liluat.render(code)
Change Lua 5.1.5 Lua 5.2.4 Lua 5.3.2 LuaJIT
slt2 v1.0 30.149s, 29.361s, 29.009s 28.867s, 29.754s, 29.467s 24.465s, 23.370s, 23.756s 20.208s, 20.292s, 20.387s
4457f27: v1.0.2 30.616s, 30.182s, 30.136s 29.835s, 30.344s, 30.012s 24.001s, 24.691s, 24.473s 20.833s, 20.149s, 20.411s
35d1ef1: output interchangeable 29.510s, 29.424s, 29.566s 29.097s, 28.704s, 28.474s 23.232s, 24.133s, 23.436s 20.257s, 20.226s, 20.429s
d289dd8: coroutines -> table 23.208s, 24.148s, 23.728s 23.027s, 22.773s, 22.620s 17.906s, 17.768s, 17.974s 16.666s, 16.108s, 16.279s

@FSMaxB FSMaxB changed the title WIP: Faster rendering Faster rendering Mar 4, 2016
FSMaxB added a commit that referenced this pull request Mar 4, 2016
@FSMaxB FSMaxB merged commit 3686f67 into master Mar 4, 2016
@FSMaxB FSMaxB deleted the fast-rendering branch March 4, 2016 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant