Live data from Hacker News

PHP 7's new hashtable implementation

nikic.github.io

101–110 of 137 posts

Re: PHP 7's new hashtable implementation

#101
post #100
post #83

Copied from /r/php (care of http://www.hhvm.rocks ): dev@aerilon ~/dev $ php --version PHP 5.5.20-pl0-gentoo (cli) (built: Dec 22 2014 13:44:21) dev@aerilon ~/dev $ hhvm --version HipHop VM 3.5.0-dev (rel) dev@aerilon ~/dev $ php memusage.php 13.97 MBs [14649088 bytes] dev@aerilon ~/dev $ hhvm memusage.php 2 MBs [2097152 bytes] So basically this implementation still uses 100% more RAM (hhvm is 64bit) by default compa…

The funny thing 5.5 isn't even the current stable version of PHP, which is 5.6. Let alone the whole post is about PHP 7. It's like you're not even paying attention, just doing the whole post for the last phrase.

I'm not sure if you know how to read:

    dev@aerilon ~/dev $ hhvm memusage.php
    2 MBs [2097152 bytes]
That is using the same benchmark that nikic is using, and it's using half the RAM of her PHP 7 example.

Please try and be less apologistic and use some reading comprehension. It makes you look more intelligent and puts less stress on other people to accommodate your intellectual laziness.

Re: PHP 7's new hashtable implementation

#102
post #83

Copied from /r/php (care of http://www.hhvm.rocks ): dev@aerilon ~/dev $ php --version PHP 5.5.20-pl0-gentoo (cli) (built: Dec 22 2014 13:44:21) dev@aerilon ~/dev $ hhvm --version HipHop VM 3.5.0-dev (rel) dev@aerilon ~/dev $ php memusage.php 13.97 MBs [14649088 bytes] dev@aerilon ~/dev $ hhvm memusage.php 2 MBs [2097152 bytes] So basically this implementation still uses 100% more RAM (hhvm is 64bit) by default compa…

Did you miss the multiple times PHP 7 was referenced? The code you pasted shows PHP 5.5.20-pl0-gentoo

Did you not read what I pasted? HHVM is using 2MB of RAM. PHP 7 is using 4MB of RAM for the same array.

How much more is 4MB compared to 2MB?

The answer, you'll find, is very close to 100%.

Re: PHP 7's new hashtable implementation

#103

This is probably not a popular opinion, but I believe that PHP's associative array is one of the best-designed data structures in programming languages. Its main distinguishing property, as mentioned in this article, is that values can be indexed by key, but are still iterated in the order they were set. This is "do what I want" in so many cases that it's just nuts. Sure, just as often it's just needless overhead, bu…

Given no other information, I'm also in the "disagree with your unique opinion" camp.

What are the use cases that you would need an ordered dictionary?

Re: PHP 7's new hashtable implementation

#106

This is probably not a popular opinion, but I believe that PHP's associative array is one of the best-designed data structures in programming languages. Its main distinguishing property, as mentioned in this article, is that values can be indexed by key, but are still iterated in the order they were set. This is "do what I want" in so many cases that it's just nuts. Sure, just as often it's just needless overhead, bu…

> I hate that many other languages, including C#, Ruby and Python, force me to choose between either an unordered map or a list of (key, value) tuples Another commenter mentioned Python's OrderedDict, and Ruby's hashtables are ordered (from 1.9+): https://www.igvita.com/2009/02/04/ruby-19-internals-ordered-... It looks like C# also has an OrderedDictionary class: http://msdn.microsoft.com/en-us/library/system.collect…

I think there is one reason to default to something ordered, which is that iterating through unordered hashmaps can be non-deterministic from one run to the other. For instance, if you hash by id, the same objects may be assigned different ids from a run to the next, meaning that the map will be iterated in a different order. If there is a bug that's sensitive to iteration order, it will not be reproducible and that can be very annoying to debug.

Re: PHP 7's new hashtable implementation

#108

This is probably not a popular opinion, but I believe that PHP's associative array is one of the best-designed data structures in programming languages. Its main distinguishing property, as mentioned in this article, is that values can be indexed by key, but are still iterated in the order they were set. This is "do what I want" in so many cases that it's just nuts. Sure, just as often it's just needless overhead, bu…

Given no other information, I'm also in the "disagree with your unique opinion" camp. What are the use cases that you would need an ordered dictionary?

When I have a dictionary of dictionaries, I want them in a particular order.

Re: PHP 7's new hashtable implementation

#109
post #100

Earlier quoted context omitted.

The funny thing 5.5 isn't even the current stable version of PHP, which is 5.6. Let alone the whole post is about PHP 7. It's like you're not even paying attention, just doing the whole post for the last phrase.

I'm not sure if you know how to read: dev@aerilon ~/dev $ hhvm memusage.php 2 MBs [2097152 bytes] That is using the same benchmark that nikic is using, and it's using half the RAM of her PHP 7 example . Please try and be less apologistic and use some reading comprehension. It makes you look more intelligent and puts less stress on other people to accommodate your intellectual laziness.

There's no such word as "apologistic" (really, look in the worduary, which should be available in your local bookery).

And the result shows PHP 7 reduced memory usage by hashtables threefold since 5.5. Yes, this is pretty good. No reason to be bitter or sarcastic.

Re: PHP 7's new hashtable implementation

#110

You mean they are not using strlen as the hash function anymore? http://news.php.net/php.internals/70691

Wow, I constantly think that nothing about the horribleness of PHP can surprise me, and then Rasmus says something even more insane than his already insane statements. I mean choosing function names based on length because you didn't bother to write an actual hash function? AMAZING.

Anyway I'm just going to leave this here because it's great fun: http://en.wikiquote.org/wiki/Rasmus_Lerdorf

Some favorites:

"There are people who actually like programming. I don't understand why they like programming."

"I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say "Yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I’ll just restart Apache every 10 requests."

Ladies and gentlemen, the author of pretty much the most popular web programming language out there!

Post reply on HN