Could someone more versed with PHP, and this project explain why turning off garbage collection helped so much? and why they didn't turn it back on at the end of the function?
Composer – Disable GC when computing deps and refs
31–40 of 135 posts
Re: Composer – Disable GC when computing deps and refs
#32Re: Composer – Disable GC when computing deps and refs
#33Looks like someone disabled garbage collection on that comment thread as well :)
Re: Composer – Disable GC when computing deps and refs
#34Re: Composer – Disable GC when computing deps and refs
#35As far as i understand composer is roughly the same thing as the cpan client. And they just simply disabled the garbage collector for it. What is this guy doing that he needs gigabytes of memory to install a bunch of php libraries? Before: Memory usage: 2194.78MB (peak: 3077.39MB), time: 1324.69s After: Memory usage: 4542.54MB (peak: 4856.12MB), time: 232.66s
Re: Composer – Disable GC when computing deps and refs
#36Earlier quoted context omitted.
It seems when you start to hit the memory limit PHP's automatic garbage collection will loop through the constructed objects to see if any can be cleaned up. If none can (and in the case of Composer all the objects exist for a reason) then it's wasting time analysing the objects. So in this case there's only a large waste of cpu doing nothing with gc enabled.
Well, yes and no, since some of the reports show an increase in memory usage, so the gc was doing something.
Re: Composer – Disable GC when computing deps and refs
#37The commit is great. I love that the comments have spiraled completely out of control. At this point, 30 minutes after the link was posted, the comment thread is now a competition to see who can post the best gif. I know we're serious here, but stuff like this reminds me why I love the internet so much. It's fun to cut loose once in a while.
Re: Composer – Disable GC when computing deps and refs
#38The commit is great. I love that the comments have spiraled completely out of control. At this point, 30 minutes after the link was posted, the comment thread is now a competition to see who can post the best gif. I know we're serious here, but stuff like this reminds me why I love the internet so much. It's fun to cut loose once in a while.
Agreed. It's such a shame that HackerNews doesn't let you post animated GIFs - I think it'd really add a lot of value to the discussions here.
\/\/\/\/
/ \
/ \
/ \
/\_/ 0 0 \_/\
| |
\/ \ |_| / \/
\ /
\ \-----/ /
\ /
\_______/
| |
Agreed. (MVP)Re: Composer – Disable GC when computing deps and refs
#39[deleted]
Re: Composer – Disable GC when computing deps and refs
#40As far as i understand composer is roughly the same thing as the cpan client. And they just simply disabled the garbage collector for it. What is this guy doing that he needs gigabytes of memory to install a bunch of php libraries? Before: Memory usage: 2194.78MB (peak: 3077.39MB), time: 1324.69s After: Memory usage: 4542.54MB (peak: 4856.12MB), time: 232.66s
So, did they exchange a 70% reduction in execution time for a 100% increment in memory usage?
The reality is even in the above edge case: 2x memory, 6x speed.