Advertisement
Guest User

phpBB benchmark on acl method...

a guest
Sep 30th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. define('IN_PHPBB', true);
  3. $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
  4. $phpEx = substr(strrchr(__FILE__, '.'), 1);
  5. include($phpbb_root_path . 'common.' . $phpEx);
  6.  
  7. // Start session management
  8. $user->session_begin();
  9. $auth->acl($user->data);
  10. $admin_acl = $auth->acl_get('a_');
  11. $loop = $loop2 = 0;
  12.  
  13. $time1 = microtime(true);
  14. while ($loop < 1000)
  15. {
  16.     if ( $auth->acl_get('a_') )
  17.     {
  18.         $loop++;
  19.     }
  20.     else
  21.     {
  22.         $loop++;   
  23.     }
  24.    
  25. }
  26. $final_time1 = (microtime(true) - $time1);
  27.  
  28. $time2 = microtime(true);
  29.  
  30. while ($loop2 < 1000)
  31. {
  32.     if ( $admin_acl )
  33.     {
  34.         $loop2++;
  35.     }
  36.     else
  37.     {
  38.         $loop2++;  
  39.     }  
  40. }
  41.  
  42. $final_time2 = (microtime(true) - $time2);
  43.  
  44. $result = 'While acl(method) time:' . $final_time1 . 's<br />' . 'While acl(var) time:' . $final_time2 . 's';
  45.  
  46. trigger_error($result);
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement