making bbPress (and WordPress) work better!

Is it bad when you start daydreaming about code?

I had this daydream the other day where I reversed the way WordPress/bbPress works and instead of running forwards by loading the entire engine first, then ALL the plugins and then finally the template, it worked BACKWARDS – where it first loaded the template and analyzed what was being requested, then loaded only the parts of the core it needed and then the plugins that were flagged as affecting the required output.

Way more complex, sure. But way less code execution and less plugin loading – and far, far, far more easy to cache parts of the pages while allowing other parts to be dynamic, without having to load nearly 500k of code among nearly 100 files.

4 responses

  1. I had the same dream😀

    August 22, 2007 at 3:23 pm

  2. luc

    the fundamental problem with most of the web applications (wordpress/drupal/…) is that they do a ton of includes. Even if do it the other way around, it will still be slow. To solve/fix the problem, I created a small php function (around 10 lines) that cache a set of include files. So can include 40 or 100 files, it doesn’t matter. You supply an array of files to include to the function and the name of the cache file, it will then create a master include file (with a name that you choose) and it will include that file instead.

    The first time the page is invoked, it will be slow (the usual wordpress time) and the next time the page is rendered, only 1 file will be included.

    WordPress was a pain to optimize because the code is badly structured. It’s a huge mess.

    I did some benchmarks and was able to cut down the time by 60%-80% when doing 1000 requests.

    May 30, 2008 at 2:24 pm

  3. Hi. Intrigued to hear you’ve got something like this working.
    How does it know what template to load?

    September 14, 2010 at 6:02 am

    • It’s kind of an exaggeration for me to say I got this particular scheme working, but I did come up with a better way than bbPress (or WordPress) does now.

      My method for now is still forward loading like a typical template system, however it’s more intelligent about what it loads instead of loading the entire one megabyte core plus possible another megabyte of plugins for each page render.

      September 14, 2010 at 1:22 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s