On 2016-04-02 14:40, Martin Alfke wrote:
On 04 Feb 2016, at 14:30, Henrik Lindberg <henrik.lindb...@cloudsmith.com>
wrote:
On 2016-04-02 11:46, Martin Alfke wrote:
This especially feels bad, when we will have performance improvement for epp in
the future.
I have not seen tickets with reports of performance problems. How bad is it?
You mentioned it somewhere at PuppetConf that in the future the epp() function
will have a performance benefit over template() function due to template()
needing the ruby stack whereas epp() is running in the java based parser (as
far as I have understood this).
It has a performance benefit already! What I was referring to is that in
order to construct the ERB context we need to iterate over all variables
in all visible scopes and create a temporary class/context where each of
those variables are added as instance variables. This may mean hundreds
or possible thousands of variables that must be copied over. This is
repeated for each an every call to template() and inline_template().
The epp() and inline_epp() does not have to do this. It simply uses the
scope (global or local depending on epp/inline_epp), then variable
access goes directly against the scope.
I noticed a performance improvement when manually playing around with
epp. But this was for small templates, and I did not write any
benchmarks for epp. However, .pp logic is slower than ruby in general,
so it depends on what you are doing.
We have ideas for further improvements.
A big improvement will come in the future when we have a native
compiler. The EPP based templates will then run much faster, and most
likely faster than ERB since ERB means calling Ruby in an external
process and serializing the 100-1000 variables for each and every
invocation.
So, unless you are using very large templates or have complex logic,
iterate over massive data structures, or having the need to use external
ruby code, I would absolutely recommend using EPP as soon as possible.
If anyone have real performance problems with EPP I would like to hear
about it so we can optimize.
Best,
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
You received this message because you are subscribed to the Google Groups "Puppet
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/n902kb%24d6b%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.