Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

ManifestBuilder Rewrite


Go to End


4 Posts   1813 Views

Avatar
Grayzag (aka ajshort)

29 Posts

26 March 2008 at 8:02pm

Edited: 27/03/2008 9:38am

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();

Avatar
Grayzag (aka ajshort)

29 Posts

26 March 2008 at 8:03pm

Edited: 26/03/2008 9:59pm

(I forgot to click the upload button)

Avatar
Sam

Administrator, 690 Posts

26 March 2008 at 10:28pm

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

Avatar
Grayzag (aka ajshort)

29 Posts

27 March 2008 at 9:35am

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.