{"id":619,"date":"2016-02-13T22:00:41","date_gmt":"2016-02-13T22:00:41","guid":{"rendered":"http:\/\/www.muratyaman.co.uk\/wp\/?p=619"},"modified":"2020-04-01T12:46:42","modified_gmt":"2020-04-01T11:46:42","slug":"the-cost-of-a-million-objects-revisited-for-php7","status":"publish","type":"post","link":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/2016\/02\/the-cost-of-a-million-objects-revisited-for-php7\/","title":{"rendered":"The cost of a million objects &#8211; revisited for PHP7"},"content":{"rendered":"<p>PHP 7 is out there finally and I am sure the adoption rate will be very slow especially because of legacy code.<\/p>\n<p>Here is a repetition of my simple tests I&#8217;ve done before (<a href=\"http:\/\/www.muratyaman.co.uk\/wp\/index.php\/2015\/09\/php-memory-usage-the-cost-of-a-million-objects\/\">PHP Memory Usage: The cost of a million objects<\/a>) and comparison of those results between PHP 5.6.18 and PHP 7.0.3.<\/p>\n<p>path-to-php5\/php.exe test-path\/memory_test_v4_objects_with_myclass_simple.php<br \/>\npath-to-php7\/php.exe test-path\/memory_test_v4_objects_with_myclass_simple.php<\/p>\n<p><a href=\"http:\/\/www.muratyaman.co.uk\/wp\/wp-content\/uploads\/2016\/02\/php-memory-usage-chart-php-7.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.muratyaman.co.uk\/wp\/wp-content\/uploads\/2016\/02\/php-memory-usage-chart-php-7-300x243.jpg\" alt=\"php-memory-usage-chart-php-7\" width=\"300\" height=\"243\" class=\"aligncenter size-medium wp-image-620\" srcset=\"https:\/\/www.muratyaman.co.uk\/blog\/wp-content\/uploads\/2016\/02\/php-memory-usage-chart-php-7-300x243.jpg 300w, https:\/\/www.muratyaman.co.uk\/blog\/wp-content\/uploads\/2016\/02\/php-memory-usage-chart-php-7.jpg 505w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I think, this shows that PHP 7 will use <strong>less memory<\/strong> (almost half in this test) and run <strong>faster<\/strong> (almost twice in this test), but I am <strong>concerned<\/strong> about the leftover memory, which is also almost 4 times the memory usage on PHP 5 (after removing objects and running garbage collection).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP 7 is out there finally and I am sure the adoption rate will be very slow especially because of legacy code.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[194,26],"class_list":["post-619","post","type-post","status-publish","format-standard","hentry","category-technology","tag-performance","tag-php"],"_links":{"self":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=619"}],"version-history":[{"count":3,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":963,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/619\/revisions\/963"}],"wp:attachment":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}