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

Is it me or is the speed issue due to the include plugin?

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
johnsum
Smarty Rookie


Joined: 22 Dec 2009
Posts: 5

PostPosted: Tue Dec 22, 2009 2:40 pm    Post subject: Is it me or is the speed issue due to the include plugin? Reply with quote

seems like the include plugin is the speed monger when including a sub-template with sub-templates in it .

instance ->

grab a template file, in said template file load a include off of a variable (doesnt have to be a variable tho, just is in my case)

inside said include, have other "plugins or modules" of which use the fetch or display functionality.

by nesting these (fetchs/display/includes) smarty takes a proverbial dump

so anyways is it me or is that the big culprit making headache?

let me know if u guys need or want some code examples i can whip some up if needed.


note: i even tried to change plugins to compilers however no progress got made the include fecth/display kills it everytime. up to 170+ ms just for that one include to other templates.

oh also whats up with merge compiled includes ? It doesn't seem to make any change with it enabled.

oops one more thing, why does display now force debug(ifenabled) in a matter where u cant override it unless u just override the function in your own class?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Tue Dec 22, 2009 3:35 pm    Post subject: Reply with quote

Hmm, do you have force_compile = false ?

Sounds strange. Would be good to have more information about your test case.
Back to top
View user's profile Send private message
johnsum
Smarty Rookie


Joined: 22 Dec 2009
Posts: 5

PostPosted: Tue Dec 22, 2009 4:01 pm    Post subject: yup let me give you a example Reply with quote

force_compile is off , but don't get me wrong ( ON compile things are ovb. more slow )

however the same area in execution smarty seems to hang after templates have been compiled.
i just wrote this real quick so sorry if it doesn't work on first go :p

example code:
Code:


class for example for plugin controller

class CustomClass{
    function serveCustomPlugin($plugin){
          // inhere we would extend to another class that hold said plugin
          return new $plugin;
    }   
}

class Pluginnamed_whatever{

     function runplugin($params=array(),$smarty){
          //for the sake of this example im keeping it simple
          $smarty->assign('blah','neato');
          return $smarty->fetch('thepluginsfile.html');
    }

}

class Pluginnamed_whatever2{

     function runplugin($params=array(),$smarty){
          //for the sake of this example im keeping it simple
          $smarty->assign('blah','neato');
          return $smarty->fetch('thepluginsfile.html');
    }

}

class Pluginnamed_whatever3{

     function runplugin($params=array(),$smarty){
          //for the sake of this example im keeping it simple
          $smarty->assign('blah','neato');
          return $smarty->fetch('thepluginsfile.html');
    }

}


custom smarty plugin to serve plugins

function smarty_function_thisguy($params,$smarty,$template){
   $pluginthis = CustomClass::serveCustomPlugin($params['do']);
   return $pluginthis->runplugin($params,$smarty);
}



main template file
<body>bla bla {include file='index.html'}
</body>


subtemplate file "index.html"

<div>{thisguy do='Pluginnamed_whatever' with='morestuff_if_needed'}</div>
<div>{thisguy do='Pluginnamed_whatever2' with='morestuff_if_needed'}</div>
<div>{thisguy do='Pluginnamed_whatever3' with='morestuff_if_needed'}</div>


thepluginsfile.html
<div>{$blah}</div>





basically nesting these seems to be too much maybe...? idk maybe you can shed some light Smile
Back to top
View user's profile Send private message
johnsum
Smarty Rookie


Joined: 22 Dec 2009
Posts: 5

PostPosted: Wed Dec 23, 2009 2:29 pm    Post subject: Reply with quote

bump?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Dec 23, 2009 3:00 pm    Post subject: Reply with quote

Your test case does compile at my system in 0.08 secs. Once compiled it renders in 0.0036 secs.

I have no idea what happens at your system.
Back to top
View user's profile Send private message
johnsum
Smarty Rookie


Joined: 22 Dec 2009
Posts: 5

PostPosted: Wed Dec 23, 2009 3:03 pm    Post subject: Reply with quote

there could be a possibility that in this example i only made one file for the plugin to be fetched in actuality there are thepluginsfile.html thepluginsfile2.html and so on for each plugin idk if that has something to do with ? but basically in my test there are 4 fetchs for the one include all being different pages.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Dec 23, 2009 3:16 pm    Post subject: Reply with quote

That does run as well.

If you turn debugging on with $smarty->debugging = true;
you should be able to see compile and rendering times for the differnet templates. Perhaps this gives you a hint.
Back to top
View user's profile Send private message
johnsum
Smarty Rookie


Joined: 22 Dec 2009
Posts: 5

PostPosted: Wed Dec 23, 2009 3:22 pm    Post subject: Reply with quote

ok well do have any suggestion being that smarty3 has some uncovered tid bits still, that might fit this logical purpose? we played with createTemplate and all kinds of other lil things but haven't manage anything more efficient then basically what i sent you.

i guess the basis is in my testing we are getting a difference in time only during fetch so what alternative is there for this logic?

note: we have extended the debug already smarty is great and does provide detailed info there thnx.
Back to top
View user's profile Send private message
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 -> Smarty 3 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