RE: [PHP-DEV] hi memory usage with php-cli

2002-11-24 Thread Pete McCormick
Hi,

For your $product array, are you using associative keys on each, so like:

$product = array('name' => $name, 'art.no' => $artnum, ... );

If so, you might find that if you replaced the string keys with constants,
you would save memory, because a constant is an integer and takes less
storage space than a string.

Example:

 $name, PROD_ARTNUM => $artnum, ... );
?>

I think that might save you some memory. Just an idea.


Pete

-Original Message-
From: Robin Ericsson [mailto:[EMAIL PROTECTED]]
Sent: November 24, 2002 12:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] hi memory usage with php-cli


Hi,


I have a huge xml-file with about 500k lines, which gives around 17000
products, which I import to a database. The problem is that the script is
taking a lot of memory, about 100mb when it's finished.

The script goes something like this
$product = array(), then I add some values to the array, name, art.no, and
when the product is done, I do $product = array(), and do the same thing
over and over.

Is there any way to configure php/zend to use less memory?

I've tried #define ZEND_DISABLE_MEMORY_CACHE 1 which doesn't help.



best regards
Robin



--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Limitations of the ZendEngine2 Object Model?

2002-11-17 Thread Pete McCormick
Hello,

I've been following the developments of the latest ZE2-enabled PHP for a
while, and I feel that some of the work regarding namespaces/nested classes
aren't quite doing what they are suppose to. An example:



If you attempt to execute this script with the PHP 4.3.0 ZE2 alphas (either
1 or 2), you'll get a fatal error specifying that "Cannot fetch parent:: as
current class scope has no parent", referring to the Child::Nested
constructor and the "parent::Nested();" line. Is the outer classes just
meant to be for namespacing purposes? Any class deriving from the parent
will not have its nested classes derive from the parents nested classes. So
then why can't nested classes be extended from anything? Just some
symbolism: P is parent, defines P.n is nested, D extends P, defines D.n
nested, yet D.n has no relation to P.n and is not allowed to extend it
explicitly (wouldn't it be implicit, with the same name and all?), nor any
other class. Doesn't quite seem to be the intended behaviour or one that
does justice to nested class or packaging/namespacing.

I think nested classes are themselves a useful language component, but
nested classes and namespaces should be handled separately. But then scoping
issues come back. Does anyone have any ideas? I'm new to the internals side
of PHP so my apologizes if these are non-issues.


Pete


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php