News for hackers. Stuff that matters.
Re:Supercolliding a PHP array (inserting 65536 elements take... by alastairpat on Thursday December 29, 2011 @08:48AM (#3403644)
I just ran this (using the PHP CLI) on my Lion MacBook Air and it took far, far longer than 30 seconds - 172, to be exact.

Not being at all familiar with the underlying mechanisms, does anybody understand why it would take so much longer on {PHP 5.3.6, Lion, my MacBook Air, the PHP CLI}?

Re:Supercolliding a PHP array (inserting 65536 elements take... by nikic on Thursday December 29, 2011 @08:57AM (#3403666)
Different hardware, different results. I ran my tests on a i3 CPU.

I don't know what a MacBook Air uses, but given that it's a notebook probably something slower :)

Re:Supercolliding a PHP array (inserting 65536 elements take... by sp332 on Thursday December 29, 2011 @09:44AM (#3403769)
I know it's hard to believe, the the low-end MBA has a Core i5 processor. https://www.apple.com/macbookair/features.html Apple worked directly with Intel to get a smaller "package", and soldered it to the mainboard to make it fit.
Re:Supercolliding a PHP array (inserting 65536 elements take... by alastairpat on Thursday December 29, 2011 @07:51PM (#3406092)
That's interesting, I've got a Core 2 Duo which I assumed would be similar to the i3 in terms of power. I guess it shows that processor versioning is more than just marketing.
Re:Supercolliding a PHP array (inserting 65536 elements take... by watmough on Thursday December 29, 2011 @11:54AM (#3404239)
That's neat, I didn't realize that you could just type 'php file' to run things. Thanks for that.

My Core Duo MacBook gave the following results:

  Inserting 32768 evil elements took 19.348465919495 seconds
  Inserting 32768 good elements took 0.0174241065979 seconds
And running from the command-line for the full 2^16:

  Inserting 65536 evil elements took 123.00568199158 seconds
  Inserting 65536 good elements took 0.038620948791504 seconds
I'm running php 5.3.6, which is the current default version on 10.6.8 I believe.
Re:Supercolliding a PHP array (inserting 65536 elements take... by tcas on Thursday December 29, 2011 @02:03PM (#3404844)
Running php -a will give you an interactive shell as well, however, if you do a lot of php development phpsh http://www.phpsh.org/ is a lot more feature rich and can be a huge timesaver.
Re:Supercolliding a PHP array (inserting 65536 elements take... by watmough on Friday December 30, 2011 @02:08PM (#3408705)
I think my development experience in php is up to maybe 15 - 20 lines or so now...

Thanks for the pointer!