Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View shortcode-test.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<?php
$content = '';
$shortcodes = array( 'one', 'two', 'three', 'four' );
foreach ( $shortcodes as $shortcode ) {
add_shortcode( $shortcode, function() use ( $shortcode ) { return $shortcode; } );
$content .= sprintf( ' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. [%s]', $shortcode );
}
$content = str_repeat( $content, 10 );
$duration = array();
for ( $i = 0; $i < 10; $i++ ) {
$start = microtime( true );
for ( $j = 0; $j < 1000; $j++ ) {
do_shortcode( $content );
strip_shortcodes( $content );
}
$end = microtime( true );
$duration[] = $end - $start;
}
printf( "Duration: %f.", array_sum( $duration ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.