Comments (7)
Mm, after taking a look at the code it looks like that literals
are indeed cached.
from raku-template-mustache.
I think after these changes (Raku/Documentable#117) it will be enough :-). As always, thanks for your help!
from raku-template-mustache.
Thank you very much for opening this issue.
I've pushed some changes in version 1.2.0 which may help, caching parsed templates which were not being cached before. If you are re-using the same template files over and over (as I suspect you are), this should be much faster now. Just make sure that you keep a single Template::Mustache instance, as the cache is stored as a member and not shared between instances.
my $stache = Template::Mustache.new: from<path/to/templates>;
for @documentables -> $doc {
# This will look up the 'document.mustache' template in the cache, and
# any of the templates it references
$stache.render: '{{< document }}', { 'title' => $doc.title, 'body' => $doc.body };
}
That being said, I am sure the Grammar for Template::Mustache is not efficient. It probably backtracks a lot more than it should. I have some ideas on fixing that, but haven't gotten to them. Hopefully the caching will be sufficient for your needs now. Please let me know how it goes!
Tim
from raku-template-mustache.
Where could I see those changes? I don't see new commits in this repo. Thanks for the fast reply!
from raku-template-mustache.
Yes, it is here on this repo (now renamed to raku-Template-Mustache
on Github). They were committed a few days ago now: 4811aad
The 1.2.0 release on CPAN has it (current version is 1.2.1, with some logging features refactored).
from raku-template-mustache.
Oh here is why I have not seen the speed changes:
https://github.com/Raku/Pod-To-HTML/blob/00d1130391a38d5a0b1b13a15738bfa889726c54/lib/Pod/To/HTML.pm#L273-L280
(preview code is not working for some reason)
I suppose literals are not being cached, or cannot be cached?
from raku-template-mustache.
Thank you, Antonio.
Yes, explicitly marked :literal
s were already being cached, after finanalyst added caching. Recent changes expanded caching to all templates, literals and non-literals alike. The :literal
hack you pointed to is no longer needed (we can just point :from
at the templates directory and let Template::Mustache
find the partials); but having it in there won't slow things down noticeably, I guess.
I'm curious what the speed difference is with the updated to Pod-To-HTML. I honestly haven't put much effort into benchmarking and optimizing. I would like to do that eventually, but have other things that are a higher priority. If the speed with caching is still a major hurdle for you, I can change my priorities.
from raku-template-mustache.
Related Issues (20)
- deprecation warning HOT 1
- Not working after glr merge HOT 4
- Test fails on Windows as of 2016.11 HOT 3
- Build fails on Rakudo 2017.3-232-gfbc6697
- Template Mustache is test fails while installing Bailador HOT 1
- Weird ordering in rendered output HOT 1
- Template::Mustache fails to install/recognize dependencies HOT 3
- The digit 0 doesn't print HOT 1
- Tag names can only contain what is considered an <ident> HOT 1
- Content of section tags spills out HOT 2
- Triple Mustache doesn't work when the field name contains a minus HOT 2
- Failing to install with Rakudo master HOT 2
- Inheritance templates HOT 5
- Doubt about Mustache specification HOT 6
- Cannot install Template::Mustache with rakudo 2019.11 HOT 1
- Allow HTML escaping to be disabled HOT 1
- Can't install Template::Mustache HOT 2
- Crash when parallel render; not thread safe? Dies with X::HyperRace::Died in test case HOT 7
- Fails to install on windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raku-template-mustache.