racke / Template-Flute

Template::Flute - Modern designer-friendly HTML templating Engine
Other
11 stars 12 forks source link

Parse::RecDecent usage in Expression needs cache/precompile #81

Closed SysPete closed 9 years ago

SysPete commented 9 years ago

NYTprof data with a container inside a nested list so container value is rechecked 186 times:

Stmts Exclusive Time Reports Source File
208892 3.22s line Parse/RecDescent.pm (including 154 string evals)
46165 2.03s line XML/Twig.pm (including 22 string evals)
9 1.01s line DBIx/Class/Storage/DBI.pm
589249 773ms line HTML/Element.pm
209395 324ms line HTML/TreeBuilder.pm
6231 35.9ms line DBIx/Class/SQLMaker.pm
8 28.8ms line Template/Flute.pm (including 3 string evals)
10 27.0ms line DBIx/Class/ResultSet.pm
racke commented 9 years ago

Wondering if this should be solved quickly or taken care of by the rewrite.

mrmaloof commented 9 years ago

How about solved quickly? I'd like to use this in production soon.

racke commented 9 years ago

I suppose you are right ... rewrites take always longer than you fathomed. I'll look into this in the next few days.

mrmaloof commented 9 years ago

Cool! Thank you. YTB (you're the best).

racke commented 9 years ago

@SysPete, can you point me to a URL in Interchange6 demo shop which exposes this problem?

racke commented 9 years ago

At any rate, should be fixed by 63bf252.

racke commented 9 years ago

The disadvantage is that the cache is never purged, which could lead to big app processes if lots of templates are used.

Suggestions?

SysPete commented 9 years ago

@racke I put a lot of effort into demoshop pages to work around this so at the moment there are no pages where this is a real problem. Next target is twig.

racke commented 9 years ago

I used for product-listing-sidebar-left for testing, but it didn't use much containers (after editing it to use the container).

"twig" ?

SysPete commented 9 years ago

How about using Tie::CHI (or just CHI directly) for cache? Then at least rarely-used pages will expire from cache.

SysPete commented 9 years ago

@racke: by twig I mean the 2s spent in XML::Twig - another issue needed there.

racke commented 9 years ago

OK please create an issue - this would be much harder to tackle though.