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 01-10-2007 07:43 AM

I am using this with 3 styles.

Do you get any php errors when switching styles? Check your logs :) White page usually means errors.

orban 01-12-2007 04:25 PM

Removed this post on author's request.

amcd 01-12-2007 04:35 PM

orban, can you briefly explain how/why this new experimental one is better than the released product?

orban 01-12-2007 04:42 PM

Well, the old one used the following "hack" for the template evals:

eval('$navbar = include("templates/1234.php");');

And that only for larger templates. Smaller ones (default setting 4500 bytes I think) were still executed the old way (even if stored in a file).

This one, however, takes a different approach.

eval('$navbar = template_1234($spacer_open, $stylevar, $GLOBALS, $welcomeheaders)');

All templates are parsed and stored in functions, and all "template function" for one page are stored in a file.

So basically all eval()s only execute a function call. This means all eval calls are nearly completely avoided, and there is just one file for every page. The files aren't too big on disk (40-100kb) but up to 2.5mb in xcache which isn't an issue though so far (I think this is because vB compiles all templates as one very long string with <if> calls being ternary conditionals).

thincom2000 01-12-2007 09:37 PM

Yeah, I noticed coding one of my plugins that using a bunch of eval()s really slows things down. I ended up rewriting the code 3 times before I came up with a way that didn't use a more than one eval() on runtime.

Thanks for the update!

thincom2000 01-18-2007 11:41 AM

What could be causing fatal undefined function errors when using the experimental code?

orban 01-18-2007 11:46 AM

That the file doesn't get included, have you created a writable cache/ folder?

amcd 01-18-2007 12:47 PM

That's really great thinking, orban. What is stopping you from making this the default method?

orban 01-18-2007 02:22 PM

Well, you can't easily "exclude" templates like in the default method so all addons that dynamically modify templates on run time will break and it's mostly untested. :)

But yeah I might release it as a second option.

thincom2000 01-18-2007 02:58 PM

Quote:

Originally Posted by orban (Post 1162109)
That the file doesn't get included, have you created a writable cache/ folder?

Yes, it is only happening on some pages. I am thinking it is an issue with those pages, but I don't really know what to look for.

I reverted to the default method to "fix" the issue.


All times are GMT. The time now is 06:00 PM.

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.01789 seconds
  • Memory Usage 1,733KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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