Re: [PHP] performance criteria on DEFINE()

2006-04-22 Thread tedd

At 3:47 PM -0500 4/21/06, Richard Lynch wrote:

On Fri, April 21, 2006 7:52 am, Jochem Maas wrote:

 Andy wrote:

 Now, one of this file can contain more than 2000 defines and we make
 a calculation that we will reach 8000 in 2 years.


Seems to me you could extend your testing to generate 8000 constants
in a file pretty easily, and just benchmark it and find out if it's
acceptable.

Hell, go for 16000 and 32000 tests as well, and benchmark those.

The pattern should be obvious pretty quickly, and you'll know, beyond
a shadow of a doubt, if you will be happy in 2 years.  (On this
issue.)


Yes, but in two years speeds will increase and prices will decrease 
drastically. What is today's "Too Big" will become tomorrow's 
"minimum requirement". For example, the $15,000 you would have spent 
in 1984 for hard drive storage can be bought today for less than one 
cent.


tedd
--

http://sperling.com

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



Re: [PHP] performance criteria on DEFINE()

2006-04-21 Thread Richard Lynch
On Fri, April 21, 2006 7:52 am, Jochem Maas wrote:
> Andy wrote:
>> Now, one of this file can contain more than 2000 defines and we make
>> a calculation that we will reach 8000 in 2 years.

Seems to me you could extend your testing to generate 8000 constants
in a file pretty easily, and just benchmark it and find out if it's
acceptable.

Hell, go for 16000 and 32000 tests as well, and benchmark those.

The pattern should be obvious pretty quickly, and you'll know, beyond
a shadow of a doubt, if you will be happy in 2 years.  (On this
issue.)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] performance criteria on DEFINE()

2006-04-21 Thread Andy

Thanks for the suggests.
I will have to make some tests to see what will happen, especially how fast. 
I will post after that my opinion.


Regards,
Andy.

- Original Message - 
From: "Jochem Maas" <[EMAIL PROTECTED]>

To: "Andy" <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, April 21, 2006 3:52 PM
Subject: Re: [PHP] performance criteria on DEFINE()



Andy wrote:
Hi, We have a big multilanguage project. For a while we used gettext to 
translate the pages, but we gave up on this because of many problems. Out 
solution is to create a file for each language which includes the 
"label" definitions. for ex: define("LABEL1", "label 1");

define("LABEL2", "label 2");
etc...

Now, one of this file can contain more than 2000 defines and we make a 
calculation that we will reach 8000 in 2 years. I made some 
testing(generated many label) in including these files into the project 
it seemed to work fine. I don't know how php handles these defines(memory 
usage, CPU etc) so the question is: how much affects the performace the 
inclusion of a lot of defines???



creating constants is _very_ slow...
if gettext is too much hassle (I can understand that ;-) it's a pity, but 
you have the alternative of

using an array:

$Lang = array(
'LABEL1' => 'hallo!',
// etc
);

OR install APC and write a routine that uses apc_define_constants() (not 
on every request obviously -
well it will becomne obvious when you read up on apc and that function in 
particular) and
apc_load_constants(). which means you can still use define() and not 
suffer the speed hit - although

be prepared to use up a little RAM :-).
note that although this means you will use the constants in your app the 
definition of the LABEL=>text pairs

will be an array if you go the APC route.

http://php.net/apc

ps - the info on constants and apc is regurgitation of advice/info coming 
direct from Rasmus.
I have never tested it, I assume he knows what he's talking about 
(otherwise why would he bother to

write apc_load_constants()/apc_define_constants()?)

pps - use single quotes for the __minimal__ decrease in processing that 
the skipping of

string interpolation causes.



Andy.






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



Re: [PHP] performance criteria on DEFINE()

2006-04-21 Thread Jochem Maas

Andy wrote:
Hi, 

We have a big multilanguage project. For a while we used gettext to translate the pages, but we gave up on this because of many problems. 

Out solution is to create a file for each language which includes the  "label" definitions. 

for ex: 
define("LABEL1", "label 1");

define("LABEL2", "label 2");
etc...

Now, one of this file can contain more than 2000 defines and we make a calculation that we will reach 8000 in 2 years. 

I made some testing(generated many label) in including these files into the project it seemed to work fine. 


I don't know how php handles these defines(memory usage, CPU etc) so the 
question is: how much affects the performace the inclusion of a lot of 
defines???



creating constants is _very_ slow...
if gettext is too much hassle (I can understand that ;-) it's a pity, but you 
have the alternative of
using an array:

$Lang = array(
'LABEL1' => 'hallo!',
// etc
);

OR install APC and write a routine that uses apc_define_constants() (not on 
every request obviously -
well it will becomne obvious when you read up on apc and that function in 
particular) and
apc_load_constants(). which means you can still use define() and not suffer the 
speed hit - although
be prepared to use up a little RAM :-).
note that although this means you will use the constants in your app the 
definition of the LABEL=>text pairs
will be an array if you go the APC route.

http://php.net/apc

ps - the info on constants and apc is regurgitation of advice/info coming 
direct from Rasmus.
I have never tested it, I assume he knows what he's talking about (otherwise 
why would he bother to
write apc_load_constants()/apc_define_constants()?)

pps - use single quotes for the __minimal__ decrease in processing that the 
skipping of
string interpolation causes.



Andy.


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



[PHP] performance criteria on DEFINE()

2006-04-21 Thread Andy
Hi, 

We have a big multilanguage project. For a while we used gettext to translate 
the pages, but we gave up on this because of many problems. 

Out solution is to create a file for each language which includes the  "label" 
definitions. 

for ex: 
define("LABEL1", "label 1");
define("LABEL2", "label 2");
etc...

Now, one of this file can contain more than 2000 defines and we make a 
calculation that we will reach 8000 in 2 years. 

I made some testing(generated many label) in including these files into the 
project it seemed to work fine. 

I don't know how php handles these defines(memory usage, CPU etc) so the 
question is: how much affects the performace the inclusion of a lot of 
defines???

Andy.