3 if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
4 print "This script must be run from the command line\n";
8 define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
9 define('GNUSOCIAL', true);
10 define('STATUSNET', true); // compatibility
12 require_once INSTALLDIR . '/scripts/commandline.inc';
13 require_once INSTALLDIR . '/extlib/php-gettext/gettext.inc';
15 common_init_locale("en_US");
16 common_init_locale('fr');
20 putenv("LANGUAGE=fr");
22 _setlocale('fr.utf8');
24 _bindtextdomain("statusnet", INSTALLDIR . '/locale');
25 _bindtextdomain("FeedSub", INSTALLDIR . '/plugins/FeedSub/locale');
30 $start = microtime(true);
31 for($i = 0; $i < $times; $i++) {
34 $delta["_"] = array((microtime(true) - $start) / $times, $result);
36 $start = microtime(true);
37 for($i = 0; $i < $times; $i++) {
40 $delta["__"] = array((microtime(true) - $start) / $times, $result);
42 $start = microtime(true);
43 for($i = 0; $i < $times; $i++) {
44 $result = dgettext("FeedSub", "Feeds");
46 $delta["dgettext"] = array((microtime(true) - $start) / $times, $result);
48 $start = microtime(true);
49 for($i = 0; $i < $times; $i++) {
50 $result = _dgettext("FeedSub", "Feeds");
52 $delta["_dgettext"] = array((microtime(true) - $start) / $times, $result);
55 $start = microtime(true);
56 for($i = 0; $i < $times; $i++) {
57 // TRANS: String in the gettext speed test script. Unimportant.
58 $result = _m("Feeds");
60 $delta["_m"] = array((microtime(true) - $start) / $times, $result);
63 $start = microtime(true);
64 for($i = 0; $i < $times; $i++) {
65 $result = fake("Feeds");
67 $delta["fake"] = array((microtime(true) - $start) / $times, $result);
69 foreach ($delta as $func => $bits) {
70 list($time, $result) = $bits;
72 printf("%10s %2.4fms %s\n", $func, $ms, $result);