Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » ManifestBuilder Rewrite

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1428 Views
  • ManifestBuilder Rewrite Link to this post

    Hi there everyone -

    Im currently in the process of having a go at speeding up the ManifestBuilder compiling process. Basically ive written a very early prototype of a new Manifest Builder, which id like to get some feedback and ideas for. Currently it reduces manifest build time by around a quarter (from 1.2 seconds to 0.9 seconds) on my local machine - id also appreciate it if some others would test it out.

    Im also creating some PHPUnit tests to ensure that functionality remains the same across both builders.

    To install, download the NewManifestBuilder.php file below, and copy it to your sapphire/core directory. Then open up main.php, and replace the line

    require_once("core/ManifestBuilder.php");


    with

    require_once("core/NewManifestBuilder.php");

    and replace the lines

    if(ManifestBuilder::staleManifest()){
       ManifestBuilder::compileManifest();
    }

    with

    NewManifestBuilder::run();

  • Re: ManifestBuilder Rewrite Link to this post

    (I forgot to click the upload button)

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: ManifestBuilder Rewrite Link to this post

    Hi Grayzag,

    To help get you started with the tests, I've committed a change to trunk
    http://open.silverstripe.com/changeset/51689

    * I refactored ManifestBuilder to make it easier to test it. ManifestBuilder::get_manifest_info($baseDir) will generate an array of manifest information based on the SilverStripe site contained at $baseDir. By passing a fake test dir in this argument, you can construct

    * I have made use of this in sapphire/tests/ManifestBuilderTest.php. The setUp() method iterates over a simple array structure to set up a set of test files in a temp folder, and passes this folder as the argument to get_manifest_info().

    I would suggest that you extend ManifestBuilderTest to make a more complete test suite. You can then patch ManifestBuilder::get_manifest_info() with your performance improvements, safe in the knowledge that you haven't broken anything!

    To run the manifest builder tests, visit (site)/TestRunner/only/ManifestBuilderTest

  • Re: ManifestBuilder Rewrite Link to this post

    Hi everyone, quick status update. Ive got the load time down to a consistent 0.9 seconds, and am aiming to chop another .1 seconds off if i can. Im around halfway through writing the tests, hopefully will finish them this afternoon. I noticed one bug with the tests, which is now fixed. Attached is my local working version of the NewManifestBuilder.

    1428 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.