[PHP4BETA] 1024 slots and functions in a single class
| From: | Kristian Köhntopp | Date: | Fri, 09 Apr 1999 13:01:42 +0000 |
| Subject: | [PHP4BETA] 1024 slots and functions in a single class | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-51@lists.php.net to get a copy of this message | ||
Generate a single class with 1024 slots and 1024 member
functions:
kk@poe /tmp/y $ cat bla2.pl
#! /opt/bin/perl --
$stop = 1024;
print "<?php
class c {
";
for ($i=0; $i<$stop; $i++) {
print qq(
var \$slot$i = $i;
function f$i() {
printf("I am function %s\\n", \$this->slot$i);
}
);
}
printf "}
\$a = new c;
";
for ($i=0; $i<$stop; $i++) {
print "\$a->f$i();\n";
}
print "\n?>\n";
kk@poe /tmp/y $ perl bla2.pl > p2.out
kk@poe /tmp/y $ time ~kk/php4/php p2.out > /dev/null
real 1m8.720s
user 0m3.743s
sys 0m12.151s
and uses 92M memory, 42M resident set size
PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU
COMMAND
26130 kk 35 0 92M 42M sleep 0:11 9.19% 30.43%
php
--
Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH
Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.shonline.de/ (GPL)
--
PHP 4 Beta