Last active
December 19, 2015 18:19
-
-
Save dhoko/5998216 to your computer and use it in GitHub Desktop.
Java vs PHP - Op.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP 5.3.3-7+squeeze15 | |
* php op.php | |
*/ | |
class Op | |
{ | |
private $lang = ''; | |
private $id = null; | |
function __construct() | |
{ | |
$this->id = 5; | |
$this->lang = ''; | |
} | |
public static function main() { | |
$stack = array(); | |
$howMuch = 0; | |
while(1) { | |
echo 'create : ',$howMuch, 'OpObject', "\n"; | |
for ($i=0; $i < 1000; $i++) { | |
$stack[] = new Op(); | |
$howMuch++; | |
} | |
if($howMuch === 8000000) exit(2); | |
} | |
} | |
} | |
Op::main(); |
Manque $howMuch++ :)
As tu essayé avec PHP 5.4 / 5.5 ? les objets dans ces versions sont beaucoup moins gros.
En tout cas, ca fait beaucoup d'objets :)
Réparé :)
Pas encore testé avec la 5.4, on a testé sur nos VM de dev qui sont identiques. On attends de passer sous debian pour retenter.
ça fait beaucoup oui, mais Java en fait bien plus et bien plus vite...
Testé sous 5.4 ce matin ;)
Il plante à 2 millions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PHP plante vers 8670000