* @version 1.0 * @author Jan Christiansen <*****@*****.**> */ /** * Benchmark 2 * Creates sitemaps with both classes, multiplying number of Urls, * to show that the cXmlSitemapGenerator, which uses the PHP DOM methods, * are using exponential more time with every url added, whereas the time * needed by cXmlSitemapGeneratorWrite is linear. */ require_once '../init/init.main.php'; require_once 'class.xmlSitemapBenchmarker.php'; set_time_limit(0); $iNumberOfUrls; $iNumberOfBenchmarks; $oBenchmark = new cXmlSitemapBenchmarker(); if (count($argv) > 3) { $oBenchmark->iNumOfMeasurements = $argv[1]; $iNumberOfUrls = $argv[2]; $iNumberOfBenchmarks = $argv[3]; echo "Running " . $oBenchmark->iNumOfMeasurements . " measurements per benchmark, " . $iNumberOfUrls . " - " . $iNumberOfUrls * $iNumberOfBenchmarks . " URLs per measurement\n"; } else { echo "Please provide number of measurements, URLs per measurement and benchmarks\n"; echo "Example: " . $argv[0] . " 30 5000 10\n"; die; } for ($i = 1; $i <= $iNumberOfBenchmarks; $i++) { $oBenchmark->addBenchmark('cXmlSitemapGenerator', $iNumberOfUrls * $i); $oBenchmark->addBenchmark('cXmlSitemapGeneratorWrite', $iNumberOfUrls * $i); } $oBenchmark->main();
* obtain it through the world-wide-web, please send an email * to opensource@myhammer.de so we can send you a copy immediately. * * @category MyHammer * @package LargeXMLSitemap * @subpackage Benchmarking * @license http://www.myhammer.de/opensource/license/gpl.txt GNU General Public License Version 3 * @version 1.0 * @author Jan Christiansen <*****@*****.**> */ /** * Benchmark 1 * Creates the same sitemaps with cXmlSitemapGenerator and cXmlSitemapGeneratorWrite. * The results shows that, cXmlSitemapGeneratorWrite is a lot faster especially if * there a lot of Urls */ require_once '../init/init.main.php'; require_once 'class.xmlSitemapBenchmarker.php'; set_time_limit(0); $oBenchmark = new cXmlSitemapBenchmarker(); if (count($argv) > 2) { $oBenchmark->iNumOfMeasurements = $argv[1]; echo "Running " . $oBenchmark->iNumOfMeasurements . " measurements per benchmark, " . $argv[2] . " URLs per measurement\n"; } else { echo "Please provide number of measurements and number of URLs per measurement\n"; echo "Example: " . $argv[0] . " 30 50000\n"; die; } $oBenchmark->addBenchmark('cXmlSitemapGenerator', $argv[2]); $oBenchmark->addBenchmark('cXmlSitemapGeneratorWrite', $argv[2]); $oBenchmark->main();