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

fetch optimization for multiple calls each page load

 
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
Bjoern3003
Smarty Rookie


Joined: 22 Nov 2004
Posts: 7

PostPosted: Wed Nov 22, 2017 9:42 am    Post subject: fetch optimization for multiple calls each page load Reply with quote

Hi there,

I have to call the fetch function multiple times each Call (ajax) to search keys in the smarty result Template.

The Code looks like this:

Code:
$DataTableSmarty = DashboardSmarty::getInstance();
$DataTableSmarty->setCaching(Smarty::CACHING_OFF);

$cell = array();
foreach($_ret->options['columns'] AS $idx => $column)
{
   $cell[] = $column['cValue'];
}

$tpl = $DataTableSmarty->createtemplate('string:' . implode(":::", $cell));

foreach($LizenzenArr AS $oLizenz)
{
   $DataTableSmarty->assign('oLizenz', $oLizenz);

   $fetched = $tpl->fetch();

   if(($filter && strpos($fetched, $_ret->options['search']['value'])!==false) || !$filter)
   {
      $row[] = explode(":::", $fetched);
   }

   //echo microtime(true) - $start .'<br>';
}


Is there a nice way, to optimize the fetch call? For 1200 rows, it would be need about 0.6724808216095 seconds.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Nov 22, 2017 6:07 pm    Post subject: Reply with quote

Why do you use Smarty in such a backward, unimaginable way?
Back to top
View user's profile Send private message
Bjoern3003
Smarty Rookie


Joined: 22 Nov 2004
Posts: 7

PostPosted: Thu Nov 23, 2017 2:08 pm    Post subject: Reply with quote

Because I have to search in the smarty compiled result. So I have to precompile all datasets.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Nov 23, 2017 4:36 pm    Post subject: Reply with quote

Why not search in the original dataset?…
Back to top
View user's profile Send private message
Bjoern3003
Smarty Rookie


Joined: 22 Nov 2004
Posts: 7

PostPosted: Thu Nov 23, 2017 7:11 pm    Post subject: Reply with quote

Because its a dynamic script, where the dataset is not known at this time. Its going about more than one object and user can set her own Smarty datatable script, so I have to set the search query after smarty compile.
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 -> 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