Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Created March 28, 2014 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovshenin/9830828 to your computer and use it in GitHub Desktop.
Save kovshenin/9830828 to your computer and use it in GitHub Desktop.
<?php
add_action( 'init', function() {
$total = 0;
for ( $i = 1; $i <= 500; $i++ ) {
$query = new WP_Query( array(
'posts_per_page' => 1,
'offset' => $i,
) );
$query->the_post();
$start = microtime( true );
get_next_post();
get_previous_post();
$total += microtime( true ) - $start;
}
printf( "%.2f ms", $total * 1000 );
die();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment