Categories > TinyButStrong general >

(tbs + tbssql) + codeigniter

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Michaelsen
Date: 2011-08-04
Time: 18:54

(tbs + tbssql) + codeigniter


Hello again Mr. Skrol29, it is always a pleasure posting in this forum.

I am starting myself with codeigniter, I believe I could call it a very nice hull or envelope for php development. I noticed ci has tons of things we would intuitively implement down the road. Its application logic in development remembers me of tbs, when exploring its features tools most of what you think should have next is already there.

After learning the hook methods on ci, I could finally wrap the models, controllers and views with tbs.

What I would like to ask you is about performance. I noticed a common thread about ci is performance and flexibility. I have to agree for what I have learned so far, however, when coming to performance, I realized ci doesn't have quite enough sofistication when speaking page caching and query caching.

Some weeks ago I looked into tbssql cache method, and today was looking at tbs cache plugin, they are very smart and very useful even to my limited knowledge of programming.

So am I right to assume tbs + tbssql can play a lead role in performance due to its cache methods? What is the bottleneck for tbs, would it be the show() method, is there where processing spikes up?

I apologize if this is a trivial  question, but I noticed how people are against a template system because of performance issues, Smarty is sometimes well spoken of, however I'm aware it doesn't have more performance than TBS.

One very interesting thing about tbs, and most developers I guess don't even dream such thing exists, is when using getbody to load files, I can have even with ci a 100% compatible Dreamweaver design for pages layout, you coud manage dozens of tables and divs individually yet keeping the layout available in real time, I had a project last year with dozens of tables, so I finally found something Dreamweaver could be useful for, instead of only reformatting the source code all the time by itself.

Regards,
- Michaelsen
By: Skrol29
Date: 2011-08-05
Time: 00:48

Re: (tbs + tbssql) + codeigniter

Hello Michaelsen,

> So am I right to assume tbs + tbssql can play a lead role in performance due to its cache methods?

Yes but in fact it actually depends of your business process ans its points of cost.

> What is the bottleneck for tbs, would it be the show() method, is there where processing spikes up?

The processing spike is in the method meth_Locator_Replace(). This function is called to calculate the final value of a field and insert it in the piece of template.
While the method seems to be a bit long, it is very fast because it uses many prepared and cached information.
Nevertheless, every parameter supported by TBS takes about 10% if the merging process. That's why adding a new parameter supported by TBS would have a sensible cost in term of merging time.
That is also why some parameters are depend of to another one, this reduces to process. For example, parameter "ope" is in fact a way to process several parameters under a unique one.


By: Michaelsen
Date: 2011-08-06
Time: 00:16

Re: (tbs + tbssql) + codeigniter

Hello again,

I believe I can understand what the meth_Locator_Replace() does. So when using tbs cache it wont get up to the point of meth_Locator_Replace()?

One more thing please, how do I put tbs cached pages and tbssql cached queries on ram, as like the memcache method? Perhaps unix would be able to recognize what files are most requested and it would keep them on ram by itself.

This is what I saw other day for mentioning the above:

$key = md5(“some sort of sql query”);
if (!($result = memcache_get($key))) {
$result = $pdo->query($qry)->fetchAll();
// cache query result for 1 hour
memcache_set($key, $result, NULL, 3600);
}

Well, looking at the code now I guess this has nothing to do with tbs or tbssql, I would, in the example above, just replace the pdo method by tbssql.

Thank you again for your attention, please keep up the good work.

Regards,
- Michaelsen
By: Skrol29
Date: 2011-08-08
Time: 23:39

Re: (tbs + tbssql) + codeigniter

Hello,

> So when using tbs cache it wont get up to the point of meth_Locator_Replace()?

Which cache to you mean ?

> One more thing please, how do I put tbs cached pages and tbssql cached queries on ram, as like the memcache method?

I'm not sure to understand your question.

The TBS Cache Plug-in does save the result content of the merging in a temporary file, until the timeout is elapsed.
As well, TbsSQL does save the result of the query in a temporary file, until the timeout is elapsed.
TbsSQL uses a method similar to your snippet, except that TbsSQL won't produce an error if by extraordinary chance, two queries have the same MD5. 
By: Michaelsen
Date: 2011-08-09
Time: 19:34

Re: (tbs + tbssql) + codeigniter


Hello again Mr. Skrol29,

I meant when the cached tbs page is served from the temporary file it won't have to execute meth_Locator_Replace(), I suppose.

I was told files being served from ram are much more faster than from the disk, truth is it doesn't even need to be said. So I was thinking how to place the temporary files generated by tbs cache and tbssql cache in ram, however as far as I know Unix is smart enough to keep in ram the most requested files.

Regards,
- Michaelsen