public function MarkdownParserBenchmarkTrait::benchmarkRender in Markdown 3.0.x
Return value
\Drupal\markdown\MarkdownBenchmark
See also
\Drupal\markdown\Plugin\Markdown\MarkdownParserBenchmarkInterface::benchmarkRender()
1 call to MarkdownParserBenchmarkTrait::benchmarkRender()
File
- src/
Traits/ MarkdownParserBenchmarkTrait.php, line 71
Class
Namespace
Drupal\markdown\TraitsCode
public function benchmarkRender($markdown, $format = NULL) {
if ($format === NULL) {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$start = microtime(TRUE);
$build = [
'#markup' => $this
->parse($markdown),
];
$result = $renderer
->renderPlain($build);
$end = microtime(TRUE);
}
else {
$start = microtime(TRUE);
$result = check_markup($markdown, $format);
$end = microtime(TRUE);
}
return MarkdownBenchmark::create('rendered', $start, $end, $result);
}