load(array('alias' => 'one')); if (!$created) { $path = ''; foreach ($path_parts as $part) { $node = entity_create('node', array('type' => 'article', 'title' => $part, 'uid' => 1)); $node->save(); if ($path == '') { $path = $part; } else { $path = "$path/$part"; } $path_crud->save('node/' . $node->id(), $path); } } $breadcrumb_builder = Drupal::service('system.breadcrumb.default'); $iterations = 100; $counter = 0; Timer::start('test'); $breadcrumb_builder->build(array()); // CSV format: First run,Average,Full time // Output time of first run as CSV. print Timer::read('test') . ','; // Reset timer to 0. Timer::start('test'); while ($counter++ < $iterations) { $breadcrumb_builder->build(array()); } $time = Timer::read('test'); // Output average as CSV print ($time / $iterations) . ','; // Output full time of this run. print "$time\n";