View Single Post
Old 04-13-2020, 08:51 PM   #24
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by chaley View Post
When I first implemented GPM I compiled the templates into python. That didn't work out when the formatter started being used in threads so I took it out. That could be the source of the thought that GPM is slower.
That's probably it.
Quote:
GPM will be slower for trivial templates such as "{authors}". It should be faster for things like "{authors:sublist(1,2,&)}". It will be faster for TPM templates like "{authors:'sublist($,1,2,'&')'}" because the quoted part is treated as a GPM template.
And that is good to know as I have done the latter a few times in answering questions here.
Quote:
Template functions are the fastest option, assuming that they do something more than return a metadata field. They are compiled into python executable code so the only overhead is looking up the function and passing the arguments.
Even better. There is something about the template language that my brain doesn't like. Using Python for some things just seems easier.
Quote:
Of course, the right way to answer the question is to time equivalent templates/programs, but I am too lazy.
Me to. And, I know that if I started doing it, I'd suddenly realise that a couple of days had gone past without actually achieving anything useful.
davidfor is offline   Reply With Quote