Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
nikic
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
22 ms
·
181.
▲
Don't be stupid: Grasp SOLID
(nikic.github.com)
39 points
by
nikic
15y ago
|
25 comments
182.
▲
by
nikic
15y ago
I sure hope that a) is going to happen. PHP 5.2 is EOLed (i.e. no security fixes) for something like a year now. PHP 5.1 even longer.
183.
▲
by
nikic
15y ago
It is somewhat risky to fundamentally change the hashing algorithm late in the release cycle (RC4). It is bound to cause problems. The ini-Option prevents the obvious threat without doing deep changes to the core.
184.
▲
by
nikic
15y ago
Even if the HT hasn't reached the full size yet all elements will nonetheless collide: If the size currently is at 16 then 64 will still have a hash of 0, as will 128, etc. For 16 simply other values would additionally collide like 16, 32,
185.
▲
by
nikic
15y ago
A leading null byte is PHP's way to mark protected and private properties. See this: http://codepad.viper-7.com/TXMSbw
186.
▲
by
nikic
15y ago
Even if the real C array contained a pointer to the last element in the LL (which it does not, it only points to the first) it would still be worst-case O(n): PHP has to check all elements in the LL to ensure that the element does not exist
187.
▲
by
nikic
15y ago
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 :)
188.
▲
by
nikic
15y ago
Actually this is not specific to PHP at all. Ruby just uses a different hashing algorithm so you need to set different keys to get these results. This is a problem that hashtables have in general (unless they are randomized).
189.
▲
Supercolliding a PHP array (inserting 65536 elements takes 30 seconds)
(nikic.github.com)
88 points
by
nikic
15y ago
|
48 comments
190.
▲
by
nikic
15y ago
Incidentally it supports quite a bit more. Even the less powerful Perl Compatible Regular Expressions (PCRE), which are used by PHP, can also easily handle context sensitive grammars (type 1): http://stackoverflow.com/questions/7434272/mat
191.
▲
by
nikic
15y ago
I actually did most of my tests with PHP 5.4 and trunk binaries, but also tested PHP 5.3 and the numbers didn't change. PHP 5.2 used 8 bytes less, because the circular GC was introduced only in PHP 5.3. By the way, you can test that yoursel
192.
▲
by
nikic
15y ago
Yep, I already got some comments on that. You are either using a 32 bit system or a 32 bit binary (at least I think that the binaries PHP distributes for Windows are compiled for 32 bit, so even if you are on a 64 bit Windows you'll still g