Re: [PHP] Implode slows down file reading? [was: str_replace performance in large mailing script]

2003-08-28 Thread Curt Zirzow
* Thus wrote CPT John W. Holmes ([EMAIL PROTECTED]):
 From: frederik feys [EMAIL PROTECTED]
 
  I thought str_replace caused slow down of my mailing script, but it
  seems to be this line of code:
 
  $fd =
  implode(,file(http://www.domain.org/store/min/Mailing_template.html;)
  );
 
  I first put the mailing template in $fd (only once) and then replace
  (str_replace) elements of it to individualize HTML emails.
  Btw i'm using php version 4.0.6.
 
  Are there better(faster) ways to read the contents of a file?
 
 file_get_contents() ?
unfortantly this is only (PHP 4 = 4.3.0).

imploading a file all the time from file simply doesn't make sense
to me, i would fread() the file directly into a string instead.

 
 The slow down is probably because you're going through HTTP to read the
 file. Is there a reason for that? Any way you can cache the file locally so
 it's not read through HTTP all of the time?

Yep, reading through http is  the slowdown.



Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Implode slows down file reading? [was: str_replace performance in large mailing script]

2003-08-27 Thread frederik feys
Hi all,

I thought str_replace caused slow down of my mailing script, but it
seems to be this line of code:

$fd =
implode(,file(http://www.domain.org/store/min/Mailing_template.html;)
);

I first put the mailing template in $fd (only once) and then replace
(str_replace) elements of it to individualize HTML emails.
Btw i’m using php version 4.0.6. 

Are there better(faster) ways to read the contents of a file?

Thanks!
Fré

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



Re: [PHP] Implode slows down file reading? [was: str_replace performance in large mailing script]

2003-08-27 Thread CPT John W. Holmes
From: frederik feys [EMAIL PROTECTED]

 I thought str_replace caused slow down of my mailing script, but it
 seems to be this line of code:

 $fd =
 implode(,file(http://www.domain.org/store/min/Mailing_template.html;)
 );

 I first put the mailing template in $fd (only once) and then replace
 (str_replace) elements of it to individualize HTML emails.
 Btw i'm using php version 4.0.6.

 Are there better(faster) ways to read the contents of a file?

file_get_contents() ?

The slow down is probably because you're going through HTTP to read the
file. Is there a reason for that? Any way you can cache the file locally so
it's not read through HTTP all of the time?

---John Holmes...

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