Last active
August 29, 2015 14:23
-
-
Save rajeshtaneja/31ed8a54f48d28f5b958 to your computer and use it in GitHub Desktop.
Test script to check performance improvement with UNION ALL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Test script to loop though get_user_access_sitewide() | |
* for each user to get performance results with UNION ALL | |
*/ | |
define('CLI_SCRIPT', true); | |
include_once("config.php"); | |
// Max users to get access info of. | |
$MAX_USERS=64000; | |
$starttime = microtime(true); | |
// Loop though the users and get capabilities. | |
for($i=1; $i < $MAX_USERS; $i++) { | |
if ($DB->record_exists('user', array('id'=>$i))) { | |
get_user_access_sitewide($i); | |
// Show progress. | |
echo "."; | |
if (($i % 70) == 0) { | |
echo " " . $i . PHP_EOL; | |
} | |
} | |
} | |
$timetaken = microtime(true) - $starttime; | |
echo $timetaken . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment