LiTWol @ Oleg Terenchuk

  • Contact
  • About me

User login

What is OpenID?
To prevent automated spam submissions leave this field empty.
  • Log in using OpenID
  • Cancel OpenID login
  • Request new password

litwol's tweets

  • Life is one large balancing act. In fact, we all work for a large circus. The funny thing is most just don't get paid for it. — 47 weeks 5 days ago
  • ‹‹
  • 2 of 9
  • ››
more
Home

Script to benchmark API execution time.

Submitted by litwol on Tue, 11/17/2009 - 22:26

<?php
error_reporting(E_ALL | E_STRICT);
define('ITERATIONS', 1000000);

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$text = 'node';

function no_op($text) {
return $text;
}
$start = microtime(true);
for ($i=0; $i < ITERATIONS; ++$i) {
}
$stop = microtime(true);
echo "nothing: " . ($stop - $start) . " seconds". PHP_EOL;

$start = microtime(true);
for ($i=0; $i < ITERATIONS; ++$i) {
$url = no_op($text);
}
$stop = microtime(true);
echo "function no_op(): " . ($stop - $start) . " seconds". PHP_EOL;

$start = microtime(true);
for ($i=0; $i < ITERATIONS; ++$i) {
$url = url($text);
}
$stop = microtime(true);
echo "url: " . ($stop - $start) . " seconds". PHP_EOL;

$start = microtime(true);
for ($i=0; $i < ITERATIONS; ++$i) {
}
$stop = microtime(true);
echo "t new: " . ($stop - $start) . " seconds". PHP_EOL;

  • 1500 reads

Recent posts

  • Developing PHP in VIM - VIM IDE for PHP
  • Creating custom fields using Drupal 7 field api
  • Creating 3d cube movieClip using Sprites and animating rotation through ActionsScript 3.0
  • Adding sprite from inside an external class onto stage and animating it using arrow key movement.
  • Playing with flash keyboard click events
  • Script to benchmark API execution time.
  • Very good dvcs guide
  • High throughput web architecture with drupal - *For authenticated users*
  • About me - Oleg Terenchuk
  • Note to self
  • Pre-generating drupal forms
  • Change memcached admin stats page
  • The cult of done

LiTWoL © Oleg Terenchuk - Hosted on Linode.com 512