Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<?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