# Garbage collector patch

- Thread: https://externals.io/message/33594
- Original archive: https://news-web.php.net/php.internals/33594
- Started by Andi Gutmans on 2007-12-03T21:01:59+00:00
- Messages: 99
- Page 1 of 4: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/33594.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #33594 — Andi Gutmans — 2007-12-03T21:01:59+00:00

URL: https://externals.io/message/33594#33594

Hi all,

 

Was hoping to send this off earlier but I was travelling for the past
week and had very limited email access.

As promised in the past few weeks we have spent a significant amount of
time in reviewing the garbage collector work and testing it in our
performance lab. Dmitry has been exchanging ideas and patches with David
Wang during this time. Suffice to say that as I've mentioned in the
past, memory management is an extremely sensitive piece of PHP, which is
why it was important for us to review this work in great depth before
committing it to the code base.

 

The updated patch still retains the same algorithm as David's original
implementation however the data structures have been changed in order to
work faster and use less memory.

 

The revised patch has the following advantages:
- It fixes several crash bugs

- Enhances performance by removing several unnecessary checks 
- The memory overhead was reduced (from 12 to 4 bytes for each
heap-allocated zval)
- The speed of "clean" PHP code (code that doesn't create cycles) was
improved
 - Additional test cases were created

The end result is a more stable and faster GC patch. That said we have
yet to find real-life applications that create significant cycles which
would benefit from this patch. In fact as you'll see from the results
our tests show an increase in maximum memory use and slower execution
(to be fair they are marginal).

 

We have tested both PHP_5_3 without any patches, the original patch and
the new patch.

 

The following table shows execution time (seconds for N requests) and
slowdown.

 

	PHP_5_3

Original GC patch 

Current GC patch

	 

 

slowdown

 

slowdown

bench

11,550

12,310

6,58%

12,170

5,37%

hello

8,781

8,852

0,81%

8,813

0,36%

xoops

128,500

135,100

5,14%

130,200

1,32%

static

18,540

20,840

12,41%

18,920

2,05%

qdig

29,320

30,270

3,24%

29,610

0,99%

qdig2

13,960

14,100

1,00%

14,090

0,93%

The next table shows memory usage in MB and overhead

 

	PHP_5_3

Original GC patch

Current GC patch

	 

 

overhead

 

overhead

hello

13,750

13,945

1,42%

13,765

0,11%

xoops

18,036

18,636

3,33%

18,568

2,95%

static

15,300

16,000

4,58%

15,308

0,05%

qdig

14,820

15,008

1,27%

14,828

0,05%

qdig2

14,824

15,012

1,27%

14,838

0,09%

 

To summarize the patch lead to approx. 5% slowdown and 3% memory
overhead for typical applications (as always, you mileage may vary
depending on your system's architecture and OS although my guesstimate
is that you will see even worse results in a 64bit environment). We also
tested SugarCRM to get another sanity for these results and we got
similar results.

 

I am not quite sure where this leaves us with this patch. On one hand I
think now the effort has been made it's a good thing to offer it as part
of PHP. The downside is of course some performance degradation and
possible instabilities as this patch continues to stabilize (it took
about two releases for us to stabilize the Zend Memory Manager even
after in-depth testing due to edge cases in allocation patterns and
various extensions, etc...).I'd be surprised if our team has found all
possible bugs.

 

Personally I think the decision should be either in or out. Adding this
as a compile option is not a good idea as it would create binary
compatibility issues and would be a pain for the community. I think my
inclination is to commit the patch, not have it #ifdef'ed but always
compiled but to have the garbage collection itself turned off by default
(mainly for stability reasons. Note: the increased memory footprint and
performance loss also exists with the collection itself turned off). We
can turn it on when we're in dev for snapshots so that we iron out bugs.
That said, as you can see from the results most people and real-life
applications will be worse off than today.

 

Thanks to David & Dmitry for working hard on this (and everyone else who
contributed).

 

The stage is open for ideas/thoughts/suggestions J


Andi

---

## #33595 — Daniel Brown — 2007-12-03T21:21:15+00:00

URL: https://externals.io/message/33594#33595 · In reply to: #33594

> Hi all,
>
>
>
> Was hoping to send this off earlier but I was travelling for the past
> week and had very limited email access.
>
> As promised in the past few weeks we have spent a significant amount of
> time in reviewing the garbage collector work and testing it in our
> performance lab. Dmitry has been exchanging ideas and patches with David
> Wang during this time. Suffice to say that as I've mentioned in the
> past, memory management is an extremely sensitive piece of PHP, which is
> why it was important for us to review this work in great depth before
> committing it to the code base.
>
>
>
> The updated patch still retains the same algorithm as David's original
> implementation however the data structures have been changed in order to
> work faster and use less memory.
>
>
>
> The revised patch has the following advantages:
> - It fixes several crash bugs
>
> - Enhances performance by removing several unnecessary checks
> - The memory overhead was reduced (from 12 to 4 bytes for each
> heap-allocated zval)
> - The speed of "clean" PHP code (code that doesn't create cycles) was
> improved
>  - Additional test cases were created
>
> The end result is a more stable and faster GC patch. That said we have
> yet to find real-life applications that create significant cycles which
> would benefit from this patch. In fact as you'll see from the results
> our tests show an increase in maximum memory use and slower execution
> (to be fair they are marginal).
>
>
>
> We have tested both PHP_5_3 without any patches, the original patch and
> the new patch.
>
>
>
> The following table shows execution time (seconds for N requests) and
> slowdown.
>
>
>
>         PHP_5_3
>
> Original GC patch
>
> Current GC patch
>
>
>
>
>
> slowdown
>
>
>
> slowdown
>
> bench
>
> 11,550
>
> 12,310
>
> 6,58%
>
> 12,170
>
> 5,37%
>
> hello
>
> 8,781
>
> 8,852
>
> 0,81%
>
> 8,813
>
> 0,36%
>
> xoops
>
> 128,500
>
> 135,100
>
> 5,14%
>
> 130,200
>
> 1,32%
>
> static
>
> 18,540
>
> 20,840
>
> 12,41%
>
> 18,920
>
> 2,05%
>
> qdig
>
> 29,320
>
> 30,270
>
> 3,24%
>
> 29,610
>
> 0,99%
>
> qdig2
>
> 13,960
>
> 14,100
>
> 1,00%
>
> 14,090
>
> 0,93%
>
> The next table shows memory usage in MB and overhead
>
>
>
>         PHP_5_3
>
> Original GC patch
>
> Current GC patch
>
>
>
>
>
> overhead
>
>
>
> overhead
>
> hello
>
> 13,750
>
> 13,945
>
> 1,42%
>
> 13,765
>
> 0,11%
>
> xoops
>
> 18,036
>
> 18,636
>
> 3,33%
>
> 18,568
>
> 2,95%
>
> static
>
> 15,300
>
> 16,000
>
> 4,58%
>
> 15,308
>
> 0,05%
>
> qdig
>
> 14,820
>
> 15,008
>
> 1,27%
>
> 14,828
>
> 0,05%
>
> qdig2
>
> 14,824
>
> 15,012
>
> 1,27%
>
> 14,838
>
> 0,09%
>
>
>
> To summarize the patch lead to approx. 5% slowdown and 3% memory
> overhead for typical applications (as always, you mileage may vary
> depending on your system's architecture and OS although my guesstimate
> is that you will see even worse results in a 64bit environment). We also
> tested SugarCRM to get another sanity for these results and we got
> similar results.
>
>
>
> I am not quite sure where this leaves us with this patch. On one hand I
> think now the effort has been made it's a good thing to offer it as part
> of PHP. The downside is of course some performance degradation and
> possible instabilities as this patch continues to stabilize (it took
> about two releases for us to stabilize the Zend Memory Manager even
> after in-depth testing due to edge cases in allocation patterns and
> various extensions, etc...).I'd be surprised if our team has found all
> possible bugs.
>
>
>
> Personally I think the decision should be either in or out. Adding this
> as a compile option is not a good idea as it would create binary
> compatibility issues and would be a pain for the community. I think my
> inclination is to commit the patch, not have it #ifdef'ed but always
> compiled but to have the garbage collection itself turned off by default
> (mainly for stability reasons. Note: the increased memory footprint and
> performance loss also exists with the collection itself turned off). We
> can turn it on when we're in dev for snapshots so that we iron out bugs.
> That said, as you can see from the results most people and real-life
> applications will be worse off than today.
>
>
>
> Thanks to David & Dmitry for working hard on this (and everyone else who
> contributed).
>
>
>
> The stage is open for ideas/thoughts/suggestions J
>
>
> Andi
>
>

    Andi,

    I don't know about how it worked for anyone else, but the tables
didn't display properly on Gmail, so I had a hard time keeping up with
the performance differences.  If you have this in a separate file,
could you send it to me as an attachment?  I have a few real-world
benchmarks I'd like to try from the angle of the shared-webhost
industry (lots of users with horrible code running simultaneously, et
cetera) which I'd like to compare to your notes.

    Thanks.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

---

## #33596 — Markus Fischer — 2007-12-03T21:31:13+00:00

URL: https://externals.io/message/33594#33596 · In reply to: #33595

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Daniel Brown wrote:
>     I don't know about how it worked for anyone else, but the tables
> didn't display properly on Gmail, so I had a hard time keeping up with
> the performance differences.  If you have this in a separate file,
> could you send it to me as an attachment?

Same problem, all in one row, to "table" to read. We're having
non-apache application which run up to one hour to do their task and I
think our QA can test the new GC there (and memory consumption is an
issue there definitely).

thanks
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHVHWh1nS0RcInK9ARAmPlAJ9XnOzFmLSl8qDxY5bLBfJBcmgqRACfZnsn
R3cFSHfkMpoffq+f5vMxI3g=
=OkMW
-----END PGP SIGNATURE

---

## #33597 — Andi Gutmans — 2007-12-03T21:38:24+00:00

URL: https://externals.io/message/33594#33597 · In reply to: #33595

Sorry about that. Does the attached PDFed screenshot work for you?

Andi

> -----Original Message-----
> From: Daniel Brown [mailto:parasane@gmail.com]
> Sent: Monday, December 03, 2007 1:21 PM
> To: Andi Gutmans
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] Garbage collector patch
> 
> 
> > […]
past
> > […]
> of
> > […]
> David
> > […]
which
> is
> > […]
before
> > […]
> original
> > […]
order
> to
> > […]
was
> > […]
> have
> > […]
> which
> > […]
results
> > […]
execution
> > […]
> and
> > […]
and
> > […]
> guesstimate
> > […]
> also
> > […]
hand
> I
> > […]
> part
> > […]
> all
> > […]
> this
> > […]
> my
> > […]
> default
> > […]
> and
> > […]
> We
> > […]
> bugs.
> > […]
> who
> > […]
> 
>     Andi,
> 
>     I don't know about how it worked for anyone else, but the tables
> didn't display properly on Gmail, so I had a hard time keeping up with
> the performance differences.  If you have this in a separate file,
> could you send it to me as an attachment?  I have a few real-world
> benchmarks I'd like to try from the angle of the shared-webhost
> industry (lots of users with horrible code running simultaneously, et
> cetera) which I'd like to compare to your notes.
> 
>     Thanks.
> 
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
> 
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.

---

## #33598 — Andi Gutmans — 2007-12-03T21:39:34+00:00

URL: https://externals.io/message/33594#33598 · In reply to: #33596

That'd be great.
Dmitry, David, can you please send the updated patch to the list?

Andi

> -----Original Message-----
> From: Markus Fischer [mailto:markus@fischer.name]
> Sent: Monday, December 03, 2007 1:31 PM
> To: Daniel Brown
> Cc: Andi Gutmans; internals@lists.php.net
> Subject: Re: [PHP-DEV] Garbage collector patch
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> Daniel Brown wrote:
> > […]
> with
> > […]
> 
> Same problem, all in one row, to "table" to read. We're having
> non-apache application which run up to one hour to do their task and I
> think our QA can test the new GC there (and memory consumption is an
> issue there definitely).
> 
> thanks
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFHVHWh1nS0RcInK9ARAmPlAJ9XnOzFmLSl8qDxY5bLBfJBcmgqRACfZnsn
> R3cFSHfkMpoffq+f5vMxI3g=
> =OkMW
> -----END PGP SIGNATURE

---

## #33599 — Daniel Brown — 2007-12-03T21:40:27+00:00

URL: https://externals.io/message/33594#33599 · In reply to: #33597

That looks great, Andi.

    Thanks.


> Sorry about that. Does the attached PDFed screenshot work for you?
>
> Andi
>
>
> > […]
> past
> > […]
> which
> > […]
> before
> > […]
> order
> > […]
> was
> > […]
> results
> > […]
> execution
> > […]
> and
> > […]
> hand
> > […]
>



-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

---

## #33600 — Daniel Brown — 2007-12-03T21:41:34+00:00

URL: https://externals.io/message/33594#33600 · In reply to: #33599

Markus,

    If for some reason the PDF attachment didn't come through to you
on the list, let me know and I'll upload it to one of my servers for
you to download and use, as well.


>     That looks great, Andi.
>
>     Thanks.
>
>
> 
> > […]
>
>
>
> --
>
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
> If at first you don't succeed, stick to what you know best so that you
> can make enough money to pay someone else to do it for you.
>



-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

---

## #33601 — Edward Z. Yang — 2007-12-03T21:42:56+00:00

URL: https://externals.io/message/33594#33601 · In reply to: #33600

Daniel Brown wrote:
> If for some reason the PDF attachment didn't come through to you
> on the list, let me know and I'll upload it to one of my servers for
> you to download and use, as well.

The PDF didn't make it through for me. Can you upload it?

-- 
 Edward Z. Yang                        GnuPG: 0x869C48DA
 HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter
 [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]

---

## #33602 — Markus Fischer — 2007-12-03T21:44:31+00:00

URL: https://externals.io/message/33594#33602 · In reply to: #33600

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

yes exactly, there was no PDF attachment. Interestingly the signature
was a separate attachment ...

thanks
- - Markus

Daniel Brown wrote:
>     Markus,
> 
>     If for some reason the PDF attachment didn't come through to you
> on the list, let me know and I'll upload it to one of my servers for
> you to download and use, as well.
> 
> 
> > […]
> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHVHi/1nS0RcInK9ARAp4KAKDKG2s1T4JZgPlAQJpsQsj7iVoSqACfQ9qt
2aF9QsCyV1tGU02vYInHQNU=
=AUjQ
-----END PGP SIGNATURE

---

## #33603 — Andi Gutmans — 2007-12-03T21:45:15+00:00

URL: https://externals.io/message/33594#33603 · In reply to: #33601

Argh. Here you go: http://cvs.php.net/~andi/GC_email.pdf


> -----Original Message-----
> From: Edward Z. Yang [mailto:edwardzyang@thewritingpot.com]
> Sent: Monday, December 03, 2007 1:43 PM
> To: internals@lists.php.net
> Subject: Re: [PHP-DEV] Garbage collector patch
> 
> Daniel Brown wrote:
> > […]
> 
> The PDF didn't make it through for me. Can you upload it?
> 
> --
>  Edward Z. Yang                        GnuPG: 0x869C48DA
>  HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter
>  [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]

---

## #33604 — Sean Coates — 2007-12-03T21:45:31+00:00

URL: https://externals.io/message/33594#33604 · In reply to: #33597

> Sorry about that. Does the attached PDFed screenshot work for you?

If only we knew how to publish documents on that 'web thing.........

(-:

S

---

## #33605 — Derick Rethans — 2007-12-03T21:49:20+00:00

URL: https://externals.io/message/33594#33605 · In reply to: #33597

> Sorry about that. Does the attached PDFed screenshot work for you?

No, as you can't attach files here....

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #33606 — Daniel Brown — 2007-12-03T21:51:31+00:00

URL: https://externals.io/message/33594#33606 · In reply to: #33605

> 
>
> > […]
>
> No, as you can't attach files here....
>
> Derick
>
> --
> Derick Rethans
> http://derickrethans.nl | http://ez.no | http://xdebug.org
>

    I didn't think it would work on the list, but I figured if Andi
either sent it to me, or clicked Reply-All, either way it would be
delivered directly to my inbox, which it was.  So now it's here:
        http://www.pilotpig.net/pdfs/

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

---

## #33607 — Dmitry Stogov — 2007-12-03T21:56:49+00:00

URL: https://externals.io/message/33594#33607 · In reply to: #33598

attached.

Dmitry.

Andi Gutmans wrote:
> That'd be great.
> Dmitry, David, can you please send the updated patch to the list?
> 
> Andi
> 
> > […]

---

## #33621 — Ilia Alshanetsky — 2007-12-04T02:43:28+00:00

URL: https://externals.io/message/33594#33621 · In reply to: #33594

First of all big thanks for Dmitry and David for spending time on this  
project and continuing to improve the original patch. Based on the  
results so far, I think the patch does have a value, but certainly not  
in a general case. Relative simple scripts have little to gain from it  
and only to loose 3-5% of speed depending on a situation and given  
insubstantial memory gains it seems of little use in general case.  
That said, there are complex applications (perhaps unnecessarily  
so ;-) ) that could see some real benefits from this code. My  
suggestion is that we make this feature a compile time flag, that's  
off by default and people who feel that their applications warrant a  
garbage collector can enable it for their install and at the same time  
those who don't (general case) have no penalties of having it in place.




> Hi all,
>
>
>
> Was hoping to send this off earlier but I was travelling for the past
> week and had very limited email access.
>
> As promised in the past few weeks we have spent a significant amount  
> of
> time in reviewing the garbage collector work and testing it in our
> performance lab. Dmitry has been exchanging ideas and patches with  
> David
> Wang during this time. Suffice to say that as I've mentioned in the
> past, memory management is an extremely sensitive piece of PHP,  
> which is
> why it was important for us to review this work in great depth before
> committing it to the code base.
>
>
>
> The updated patch still retains the same algorithm as David's original
> implementation however the data structures have been changed in  
> order to
> work faster and use less memory.
>
>
>
> The revised patch has the following advantages:
> - It fixes several crash bugs
>
> - Enhances performance by removing several unnecessary checks
> - The memory overhead was reduced (from 12 to 4 bytes for each
> heap-allocated zval)
> - The speed of "clean" PHP code (code that doesn't create cycles) was
> improved
> - Additional test cases were created
>
> The end result is a more stable and faster GC patch. That said we have
> yet to find real-life applications that create significant cycles  
> which
> would benefit from this patch. In fact as you'll see from the results
> our tests show an increase in maximum memory use and slower execution
> (to be fair they are marginal).
>
>
>
> We have tested both PHP_5_3 without any patches, the original patch  
> and
> the new patch.
>
>
>
> The following table shows execution time (seconds for N requests) and
> slowdown.
>
>
>
> 	PHP_5_3
>
> Original GC patch
>
> Current GC patch
>
> 	
>
>
>
> slowdown
>
>
>
> slowdown
>
> bench
>
> 11,550
>
> 12,310
>
> 6,58%
>
> 12,170
>
> 5,37%
>
> hello
>
> 8,781
>
> 8,852
>
> 0,81%
>
> 8,813
>
> 0,36%
>
> xoops
>
> 128,500
>
> 135,100
>
> 5,14%
>
> 130,200
>
> 1,32%
>
> static
>
> 18,540
>
> 20,840
>
> 12,41%
>
> 18,920
>
> 2,05%
>
> qdig
>
> 29,320
>
> 30,270
>
> 3,24%
>
> 29,610
>
> 0,99%
>
> qdig2
>
> 13,960
>
> 14,100
>
> 1,00%
>
> 14,090
>
> 0,93%
>
> The next table shows memory usage in MB and overhead
>
>
>
> 	PHP_5_3
>
> Original GC patch
>
> Current GC patch
>
> 	
>
>
>
> overhead
>
>
>
> overhead
>
> hello
>
> 13,750
>
> 13,945
>
> 1,42%
>
> 13,765
>
> 0,11%
>
> xoops
>
> 18,036
>
> 18,636
>
> 3,33%
>
> 18,568
>
> 2,95%
>
> static
>
> 15,300
>
> 16,000
>
> 4,58%
>
> 15,308
>
> 0,05%
>
> qdig
>
> 14,820
>
> 15,008
>
> 1,27%
>
> 14,828
>
> 0,05%
>
> qdig2
>
> 14,824
>
> 15,012
>
> 1,27%
>
> 14,838
>
> 0,09%
>
>
>
> To summarize the patch lead to approx. 5% slowdown and 3% memory
> overhead for typical applications (as always, you mileage may vary
> depending on your system's architecture and OS although my guesstimate
> is that you will see even worse results in a 64bit environment). We  
> also
> tested SugarCRM to get another sanity for these results and we got
> similar results.
>
>
>
> I am not quite sure where this leaves us with this patch. On one  
> hand I
> think now the effort has been made it's a good thing to offer it as  
> part
> of PHP. The downside is of course some performance degradation and
> possible instabilities as this patch continues to stabilize (it took
> about two releases for us to stabilize the Zend Memory Manager even
> after in-depth testing due to edge cases in allocation patterns and
> various extensions, etc...).I'd be surprised if our team has found all
> possible bugs.
>
>
>
> Personally I think the decision should be either in or out. Adding  
> this
> as a compile option is not a good idea as it would create binary
> compatibility issues and would be a pain for the community. I think my
> inclination is to commit the patch, not have it #ifdef'ed but always
> compiled but to have the garbage collection itself turned off by  
> default
> (mainly for stability reasons. Note: the increased memory footprint  
> and
> performance loss also exists with the collection itself turned off).  
> We
> can turn it on when we're in dev for snapshots so that we iron out  
> bugs.
> That said, as you can see from the results most people and real-life
> applications will be worse off than today.
>
>
>
> Thanks to David & Dmitry for working hard on this (and everyone else  
> who
> contributed).
>
>
>
> The stage is open for ideas/thoughts/suggestions J
>
>
> Andi
>

Ilia Alshanetsky

---

## #33622 — Cristian Rodriguez — 2007-12-04T03:00:18+00:00

URL: https://externals.io/message/33594#33622 · In reply to: #33621

2007/12/3, Ilia Alshanetsky <ilia@prohost.org>:
> I think the patch does have a value,

yes, it does, what worries me is the introduction of yet another
non-sense ini setting that modified the very engine behaviuor.. I
think we all agree that there are way too many of those do we ?


. My
> suggestion is that we make this feature a compile time flag.

My suggestion is not to add any compile time flag, either provide it or dont.

> and people who feel that their applications warrant a
> garbage collector can enable it for their install and at the same time
> those who don't (general case) have no penalties of having it in place.

People more commonly uses PHP from distributors, in binary form.. they
dont usually decide what is enabled or not, so you have to either
reccommend this feature or mark it clearly as untrusted, experimental.

such switches only add more complexity, confusion for users and
addtional trouble to distributors.

my 2CLP.


-- 
http://www.kissofjudas.net/

---

## #33623 — Steph Fox — 2007-12-04T04:15:22+00:00

URL: https://externals.io/message/33594#33623 · In reply to: #33622

> such switches only add more complexity, confusion for users and
> addtional trouble to distributors.

FWIW, amen to that.

- Steph

---

## #33626 — Ronald Chmara — 2007-12-04T06:06:19+00:00

URL: https://externals.io/message/33594#33626 · In reply to: #33594

> Hi all,
>
> Was hoping to send this off earlier but I was travelling for the past
> week and had very limited email access.
>
> As promised in the past few weeks we have spent a significant  
> amount of
> time in reviewing the garbage collector work and testing it in our
> performance lab. Dmitry has been exchanging ideas and patches with  
> David
> Wang during this time. Suffice to say that as I've mentioned in the
> past, memory management is an extremely sensitive piece of PHP,  
> which is
> why it was important for us to review this work in great depth before
> committing it to the code base.
>
> The updated patch still retains the same algorithm as David's original
> implementation however the data structures have been changed in  
> order to
> work faster and use less memory.
> ...
> Personally I think the decision should be either in or out. Adding  
> this
> as a compile option is not a good idea as it would create binary
> compatibility issues and would be a pain for the community.
> ...
> The stage is open for ideas/thoughts/suggestions

I'm really hesitant to even *mention* this idea, but....

Could "alternate" memory management systems be made available via  
PECL add-ons, or, more to the point:
What is the *actual cost and complexity* involved in implementing  
(possibly many) different user-selectable memory management systems,  
and what other future benefits/drawbacks might we see by doing such a  
thing? (GC is big now, but what about memory pools per mod_auth user,  
or SHM/SEM pools, or tuning amounts of memory per function, etc...)

I will now apologize to everybody who I just made cry, scream, or  
damage their furniture, as I didn't mean to hurt you, just trying to  
stimulate ideas.

-Ronabop

---

## #33627 — Andi Gutmans — 2007-12-04T06:30:12+00:00

URL: https://externals.io/message/33594#33627 · In reply to: #33626

> -----Original Message-----
> From: Ronald Chmara [mailto:ron@Opus1.COM]
> Sent: Monday, December 03, 2007 10:06 PM
> To: Andi Gutmans
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] Garbage collector patch
> I'm really hesitant to even *mention* this idea, but....
> 
> Could "alternate" memory management systems be made available via
> PECL add-ons, or, more to the point:
> What is the *actual cost and complexity* involved in implementing
> (possibly many) different user-selectable memory management systems,
> and what other future benefits/drawbacks might we see by doing such a
> thing? (GC is big now, but what about memory pools per mod_auth user,
> or SHM/SEM pools, or tuning amounts of memory per function, etc...)
> 
> I will now apologize to everybody who I just made cry, scream, or
> damage their furniture, as I didn't mean to hurt you, just trying to
> stimulate ideas.

Hi Ronald,

PHP 5.2.x already supports the ability to hook in different "page"
managers. In PHP 5.3 you can also override the memory allocation
functions. However, this would not include garbage collection like
algorithms which actually require changes in the core PHP data type such
as zvals. In fact the garbage collection adds memory to the basic
datatypes which is why I suggested to either always make these changes,
or don't make them so that we retain binary compatibility across all
builds of PHP.
So overriding basic memory allocation functions, yes, ability to provide
various GC implementations, no.

Andi

---

## #33629 — Ronald Chmara — 2007-12-04T07:46:13+00:00

URL: https://externals.io/message/33594#33629 · In reply to: #33627

> > […]
>
> Hi Ronald,
>
> PHP 5.2.x already supports the ability to hook in different "page"
> managers. In PHP 5.3 you can also override the memory allocation
> functions. However, this would not include garbage collection like
> algorithms which actually require changes in the core PHP data type  
> such
> as zvals. In fact the garbage collection adds memory to the basic
> datatypes which is why I suggested to either always make these  
> changes,
> or don't make them so that we retain binary compatibility across all
> builds of PHP.
> So overriding basic memory allocation functions, yes, ability to  
> provide
> various GC implementations, no.

Okay, so, without this patch, I can allocate mem, and destroy it, on  
a per page level, but not on a zval level, and the choice is:
a) zval (etc.) destruction with this patch, which has a 5% speed hit  
at times (varies per test)
b) no patch, no change
c) something which hasn't been thought of yet?

I'd have to (sadly) ask that anything that slows down PHP by 5%, to  
improve performance for programmers that, uhm, "leak" or otherwise  
gobble RAM, that they, uhm, refactor their code as professional  
programmers.

Thanks for clearing it up for me, Andi.

-Bop

---

## #33631 — Antony Dovgal — 2007-12-04T08:28:27+00:00

URL: https://externals.io/message/33594#33631 · In reply to: #33622

> such switches only add more complexity, confusion for users and
> addtional trouble to distributors.

... which I believe are going to enable this flag by default anyway, 
because they don't care about performance too much.

So I agree, either do it or not, yet another engine mode is bad idea.

-- 
Wbr, 
Antony Dovgal

---

## #33633 — Alexey Zakhlestin — 2007-12-04T09:45:33+00:00

URL: https://externals.io/message/33594#33633 · In reply to: #33631

I believe this has to be done and it should be always on.
Having less headache is good. I will find other ways to speed up my projects


> 
> > […]
>
> ... which I believe are going to enable this flag by default anyway,
> because they don't care about performance too much.
>
> So I agree, either do it or not, yet another engine mode is bad idea.
>
> --
> Wbr,
> Antony Dovgal
>
> --
> 
> 
>
>


-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #33635 — Jani Taskinen — 2007-12-04T11:42:41+00:00

URL: https://externals.io/message/33594#33635 · In reply to: #33622

> 2007/12/3, Ilia Alshanetsky <ilia@prohost.org>:
> > […]
> 
> yes, it does, what worries me is the introduction of yet another
> non-sense ini setting that modified the very engine behaviuor.. I
> think we all agree that there are way too many of those do we ?

Yup. :)

> > […]
> 
> My suggestion is not to add any compile time flag, either provide it or dont.

I have to agree. Either it's in or not. We've had enough trouble with
giving too much rope for people already..

-- 
Patches/Donations: http://pecl.php.net/~jani/

---

## #33640 — dz@bitxtender.com — 2007-12-04T14:33:38+00:00

URL: https://externals.io/message/33594#33640 · In reply to: #33621

I could be wrong, of course, but my guess is that the ~3% speed decrease
a) is not really significant to 95% of the users (I mean _really_  
significant; of course, everyone is going to whine about it first) and
b) is going to be eliminated over time


david



Am 04.12.2007 um 03:43 schrieb Ilia Alshanetsky:

> First of all big thanks for Dmitry and David for spending time on  
> this project and continuing to improve the original patch. Based on  
> the results so far, I think the patch does have a value, but  
> certainly not in a general case. Relative simple scripts have little  
> to gain from it and only to loose 3-5% of speed depending on a  
> situation and given insubstantial memory gains it seems of little  
> use in general case. That said, there are complex applications  
> (perhaps unnecessarily so ;-) ) that could see some real benefits  
> from this code. My suggestion is that we make this feature a compile  
> time flag, that's off by default and people who feel that their  
> applications warrant a garbage collector can enable it for their  
> install and at the same time those who don't (general case) have no  
> penalties of having it in place.
>
>
> 
>
> > […]
>
> Ilia Alshanetsky
>
> -- 
> 
> 
>
>

--
David Zülke
dz@bitxtender.com
Tel: +49 (0)89 57 08 15 15
bitXtender GbR
Paul-Heyse-Straße 6
80336 München

---

## #33642 — Daniel Brown — 2007-12-04T14:54:19+00:00

URL: https://externals.io/message/33594#33642 · In reply to: #33629

> I'd have to (sadly) ask that anything that slows down PHP by 5%, to
> improve performance for programmers that, uhm, "leak" or otherwise
> gobble RAM, that they, uhm, refactor their code as professional
> programmers.

    In the general scope, Ron, you're correct.  Where I think this
could really shine is on a shared hosting server, where you may have
dozens - even hundreds - of small, novice web sites, all "programmed
real good-like".

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

---

Next page: https://externals.io/message/33594.md?page=2
