Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty, parsing takes too much time [solved]

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
olivierpons
Smarty Rookie


Joined: 13 Aug 2011
Posts: 13
Location: France

PostPosted: Fri Mar 16, 2012 10:58 am    Post subject: Smarty, parsing takes too much time [solved] Reply with quote

Hi!

I've got a huge Js file that is 2,3 Mb long (it's ExtJS debug file).

All my js file are parsed through Smarty so that I can put whenever I want some "dynamic" stuff of mine.

The problem is that I've enclosed this (huge) js code between the tags
Code:
{literal}
and
Code:
{/literal}
.

Smarty doesn't seem to care and still tries to parse the whole file and I get to this point:

Code:
<font color=#ff0000><pre>
Fatal error: Maximum execution time of 30 seconds exceeded in /web/htdocs/olivier/pizzas/dev/libs/smarty/libs/sysplugins/smarty_internal_templateparser.php on line 2341
</pre></font>

whereas it should just let the whole file "as is".

I'm forced to apply an ugly patch: if I find "/ext/" in the path, I echo the file without any parsing, which makes it both annoying and ugly:

Code:
    if ($class=='js') {
      if (mb_strpos($this->template,'/ext/')!==false) {
        echo file_get_contents($this->template);
        exit(0);
      }   
    }   


Is there any way / anything I could do?


Last edited by olivierpons on Fri Mar 16, 2012 12:38 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Mar 16, 2012 12:28 pm    Post subject: Reply with quote

Which Smarty version do you use?

This should have been fixed with Smarty 3.1.7
Back to top
View user's profile Send private message
olivierpons
Smarty Rookie


Joined: 13 Aug 2011
Posts: 13
Location: France

PostPosted: Fri Mar 16, 2012 12:31 pm    Post subject: Reply with quote

I'm using Smarty 3.1 I'll install 3.1.7 and tell you if it is fixed.
Back to top
View user's profile Send private message Visit poster's website
olivierpons
Smarty Rookie


Joined: 13 Aug 2011
Posts: 13
Location: France

PostPosted: Fri Mar 16, 2012 12:38 pm    Post subject: Reply with quote

Ok it works. It's fast (~2s instead of 198s). It's still too slow for me but hey I guess this is not smarty's fault, it's the system (read a 2,5 Mb Js file in memory, allocate stuff and so on).

And that's a nice news, because I was doing the same with a lot of static files (CSS and so on) so now it should be a lot faster for those files as well.

Thank you for pointing the right solution Very Happy
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP