Re: [PHP] Disadvantages of output buffering

2007-07-03 Thread Richard Lynch
On Tue, June 26, 2007 8:54 am, Robin Vickery wrote:

CON:

On a dev server, when you screw up and write an infinite loop, PHP
spends a hell of a lot more time spinning its wheels before you kill
it because your infinitely long output is all buffered up.

[innocent voice]
Not that that has ever happened to me, oh no.
[/innocent]

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Disadvantages of output buffering

2007-07-03 Thread Richard Lynch
On Tue, June 26, 2007 7:33 am, Emil Edeholt wrote:

 My php project would get a much cleaner code if I could set cookies
 anywhere in the code. So I thought of output buffering. But I can't
 find
 any articles on the cons of output buffering. I mean it most be a
 reason
 for it being off by default?

Main reason to be off by default is backwards compatibility.

Depending on your PHP, HTML and/or CSS and browser rendering, output
buffering can also make a site seem slow since it buffers up all the
output until the page is complete.

But you'd have to have some pretty heavy lifting in PHP buried in the
middle of the HTML output for that to be meaningful.  That's usually a
bad Design decision, but there might be some cases where it's
relevant.

There also have been a lot of benchmarks to prove buffering was
better/worse/faster/slower.  You're on your own about which ones to
believe.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Disadvantages of output buffering

2007-07-03 Thread Robert Cummings
On Tue, 2007-07-03 at 02:23 -0500, Richard Lynch wrote:
 On Tue, June 26, 2007 8:54 am, Robin Vickery wrote:
 
 CON:
 
 On a dev server, when you screw up and write an infinite loop, PHP
 spends a hell of a lot more time spinning its wheels before you kill
 it because your infinitely long output is all buffered up.
 
 [innocent voice]
 Not that that has ever happened to me, oh no.
 [/innocent]

I'm sorry but your SQUAREML is poorly formed. I was unable to parse your
message. Please resend according to webservice specs.

;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Disadvantages of output buffering

2007-06-26 Thread Robert Cummings
On Tue, 2007-06-26 at 14:33 +0200, Emil Edeholt wrote:
 Hi!
 
 My php project would get a much cleaner code if I could set cookies 
 anywhere in the code. So I thought of output buffering. But I can't find 
 any articles on the cons of output buffering. I mean it most be a reason 
 for it being off by default?

Cons of output buffering:

- tncy weency time overhead
- memory overhead since buffered content remains in memory
  until flushed.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Disadvantages of output buffering

2007-06-26 Thread Emil Edeholt
Thanks for your help Dave and Rob. I will start using output buffering a 
lot more now.


Regards Emil

Robert Cummings wrote:

Cons of output buffering:

- tncy weency time overhead
- memory overhead since buffered content remains in memory
  until flushed.

Cheers,
Rob.
  


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



Re: [PHP] Disadvantages of output buffering

2007-06-26 Thread Stut

Robert Cummings wrote:

On Tue, 2007-06-26 at 14:33 +0200, Emil Edeholt wrote:

Hi!

My php project would get a much cleaner code if I could set cookies 
anywhere in the code. So I thought of output buffering. But I can't find 
any articles on the cons of output buffering. I mean it most be a reason 
for it being off by default?


Cons of output buffering:

- tncy weency time overhead


Compared to the time taken to flush to the client more often? This is 
incorrect in most cases, and even when it's not it really really is 
tncy weency.



- memory overhead since buffered content remains in memory
  until flushed.


Indeed, but memory is cheap and you're likely to run out of memory for 
other reasons way before output buffering causes it.


-Stut

--
http://stut.net/

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



Re: [PHP] Disadvantages of output buffering

2007-06-26 Thread Robert Cummings
On Tue, 2007-06-26 at 14:09 +0100, Stut wrote:
 Robert Cummings wrote:
  On Tue, 2007-06-26 at 14:33 +0200, Emil Edeholt wrote:
  Hi!
 
  My php project would get a much cleaner code if I could set cookies 
  anywhere in the code. So I thought of output buffering. But I can't find 
  any articles on the cons of output buffering. I mean it most be a reason 
  for it being off by default?
  
  Cons of output buffering:
  
  - tncy weency time overhead
 
 Compared to the time taken to flush to the client more often? This is 
 incorrect in most cases, and even when it's not it really really is 
 tncy weency.
 
  - memory overhead since buffered content remains in memory
until flushed.
 
 Indeed, but memory is cheap and you're likely to run out of memory for 
 other reasons way before output buffering causes it.

Agreed, I was hard pressed to come up with cons in the first place :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Disadvantages of output buffering

2007-06-26 Thread Robin Vickery

On 26/06/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Tue, 2007-06-26 at 14:09 +0100, Stut wrote:
 Robert Cummings wrote:
  On Tue, 2007-06-26 at 14:33 +0200, Emil Edeholt wrote:
  Hi!
 
  My php project would get a much cleaner code if I could set cookies
  anywhere in the code. So I thought of output buffering. But I can't find
  any articles on the cons of output buffering. I mean it most be a reason
  for it being off by default?
 
  Cons of output buffering:
 
  - tncy weency time overhead

 Compared to the time taken to flush to the client more often? This is
 incorrect in most cases, and even when it's not it really really is
 tncy weency.

  - memory overhead since buffered content remains in memory
until flushed.

 Indeed, but memory is cheap and you're likely to run out of memory for
 other reasons way before output buffering causes it.

Agreed, I was hard pressed to come up with cons in the first place :)


Modern browsers often start partially rendering HTML as soon as it
arrives rather than waiting for the page to load completely.
Obviously, if you're waiting until the end of the script before
actually sending any HTML, they can't do that so your page might
appear less responsive.

-robin

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



Re: [PHP] Disadvantages of output buffering

2007-06-26 Thread William Lovaton
These two reasons are in fact of little impact.

The real problem I have with output buffering in my web app is that it
doesn't handle .xls and .pdf files generated on the fly with PHP.  Every
time the browser is going to download those kind of files it will get
corrupted.

The only solution I could find for this was to disable output buffering.

Another thing: you can even compress the buffer before sending it so it
will help a lot if a user have little bandwidth.  Text files have a very
good compression ratio.

Cheers,


-William


On Tue, 2007-06-26 at 09:04 -0400, Robert Cummings wrote:
 On Tue, 2007-06-26 at 14:33 +0200, Emil Edeholt wrote:
  Hi!
  
  My php project would get a much cleaner code if I could set cookies 
  anywhere in the code. So I thought of output buffering. But I can't find 
  any articles on the cons of output buffering. I mean it most be a reason 
  for it being off by default?
 
 Cons of output buffering:
 
 - tncy weency time overhead
 - memory overhead since buffered content remains in memory
   until flushed.
 
 Cheers,
 Rob.
 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 

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