vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Board Optimization - Plugin Based Template Cache (https://vborg.vbsupport.ru/showthread.php?t=121876)

orban 07-21-2007 03:12 PM

1) As I said if you are interested in maximizing performance take a look at the one I marked as experimental, I will actually clean that up a bit soon and upload here. Just did a quick and dirty benchmark with microtime, you save about 4*10^-6 seconds if you remove the double eval.

2) Good idea, thanks. Clearing the cache in the shell is the best idea anyway. ;)

Andreas 07-21-2007 04:45 PM

The experimental Version is quite nice :)

However if breaks

Template foobarcheck
Code:

<if condition="$foo = 'bar'">
</if>

PHP Code:

$foo 'foo';
eval(
'$devnull = "' fetch_template('foobarcheck') . '";');
// $foo = ? 

Without this Plugin, $foo is bar. With this plugin it is still foo.

Also, you don't need to pass superglobals like $GLOBALS ;)

orban 07-21-2007 04:48 PM

Do vB default templates have <if> conditions? Because all the default templates work fine for me. Feel free to filter out $GLOBALS, but what does it matter anyway? This level of detail is absolutely unnecessary you won't gain any performance by spending your time on that. The step from eval(very long string) to eval(function call cached by opcode cacher) is the important one.

Andreas 07-21-2007 06:14 PM

Quote:

Do vB default templates have <if> conditions?
Yes, they do - kind of.

Template memberlist_resultsbit for example:
Code:

<if condition="$show['emailcol'] AND exec_switch_bg()"><td class="$bgclass">
Without your plugin, you will get alternating column backgrounds.
With your Plugin, you won't

By using references, you could fix that; would also save some memory/processing.
For example, $vbphrase is used in almost all templates.
With the current code, this array is always being copied when a template is eval'ed.

Nevermid, I just wanted to make suggestion to improve this further. Sorry.

orban 07-21-2007 10:57 PM

Alright I see where you are coming from. Yeah references will solve the problem, vB's code is more messed up than you'd ever think. Well I updated functions_template_cache.php.

RS_Jelle 07-25-2007 06:39 PM

Quote:

Originally Posted by orban (Post 1297797)
Alright I see where you are coming from. Yeah references will solve the problem, vB's code is more messed up than you'd ever think. Well I updated functions_template_cache.php.

So we just need to upload the new functions_template_cache.php to our FTP to have the everything actual on our forum for this mod?

It would be easier if you gave it a new version number (and eventually send an update mail to all users). Now it's a bit confusing as there's no concrete information about the changes (or we need to read the full thread) and the mod is marked as updated ...

orban 07-25-2007 07:04 PM

It would be easier if you read the first line.

RS_Jelle 07-25-2007 07:44 PM

Quote:

Originally Posted by orban (Post 1301496)
It would be easier if you read the first line.

I'm sorry, I missed that line :)


All times are GMT. The time now is 05:25 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01392 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete