Live data from Hacker News

Hack: a new programming language for HHVM

code.facebook.com

331–340 of 422 posts

Re: Hack: a new programming language for HHVM

#331
Every negativity thread on PHP on HN just serves as a reminder how poorly informed and inexperienced most developers here really are.

Good to keep in mind the next time you read a topic on how awesome language X/framework Y/method Z is.

It's depressing to see how much of our profession is informed by the desire to being cool and fashionable, like kids in schoolyard.

Re: Hack: a new programming language for HHVM

#332
post #156

Earlier quoted context omitted.

Can you rephrase your question about the ops perspective? Is there something in particular you want to know about?

Sure. I guess I'm wondering how it compares to running plain old Apache/PHP in a production environment. Or, is it more like a Django/Rails stack? Does it use the same memory footprint as PHP, etc?

On the scale of a single request (doing stuff from the command line), most benchmarks I've seen are about half the memory footprint. Obviously that's going to vary program to program ($data = file_get_contents("some2gbfile.txt"); is going to take 2GB, regardless), but for "normal usage" 1/2 looks fairly common.

On a webserver, that goes further since HHVM is single-process/multi-thread, whereas PHP (in its typical setup) is multi-process/single-thread. This cuts HHVM's memory overhead much further.

Yes, PHP can run multi-threaded, but it still has a number of instability issues in that mode.

Re: Hack: a new programming language for HHVM

#333

It looks promising, I highly dislike writing PHP and this seems like it might ease the pain, but they could've gotten rid of the damn dollar sign in front of variables, how ugly is this? "return ($y) ==> { return $y + 1; }"

Engineer working on Hack here. You can actually write you example a bit more concisely in Hack: "$y ==> $y + 1".

Return statements are optional? So it's just the last statement in a function that'll get returned?

Re: Hack: a new programming language for HHVM

#334
post #87

I am baffled as to why you'd build your castle atop a crumbling foundation. I have wondered why FB didn't use a proper language with proper typing to begin with. I mean, I "understand" logistically: they already had a giant codebase in PHP, migrating a codebase is expensive, and it's difficult to hire and train 1000s of hackers in e.g., OCaml. (They do have some OCaml people, but they are outliers. OCaml was my favor…

The HN crowd seems to dislike (or despise perhaps?) PHP, but it's really not that bad. Yes it has a lot of warts, but it has a lot of things that make it nice for web development. a) try your new code by saving in your editor, and hitting reload in your web browser. b) it's very approachable. People who only know HTML and CSS can be expected to do a little bit of PHP work to integrate their changes. If you setup the…

If you want to know: just checked the one project where I did a long running PHP-process.

It is a job scheduler which takes jobs from a Redis queue and executes it.

It does fork a new process for 1 type of task (image resizing in this case) to make sure it doesn't leak memory.

It also reuses these forked processes so it doesn't need to fork for every task.

It was last started on Jan. 2013 (because of maintenance) and still running fine.

The reason ? I didn't want to introduce an extra language for project for which all the server code was already written in PHP.

So if it fits the task, you can do it.

Re: Hack: a new programming language for HHVM

#335
post #253

Earlier quoted context omitted.

As much as I prefer not to engage trolls... Which language would have been a good technical decision in 2002-2003? It needs to be fast enough in terms of iteration. It needs to not require more resources than PHP. It must be easy to onboard people who don't know it onto. It needs to be easy to operate, and not be costly to deploy on the tens, hundreds, and then thousands of servers necessary. (Spending time learning…

> Which language would have been a good technical decision in 2002-2003? It must be easy to onboard people who don't know it onto. It needs to be easy to operate, and not be costly to deploy on the tens, hundreds, and then thousands of servers necessary. You mean, like the JVM? 2003 wasn't the pliocene epoch, we had a working JVM. If you remember back to the last bubble, in the 90s , we were shipping "easy to operate…

"the intervening years allowed the PHP mess to become only more entrenched"

They specifically choose to do it and not move to an other language. One of the reasons was: PHP programmers are cheap and plenty full and can do quick iterations.

Sounds a bit like you are complaining about other peoples choices, it really is their choice. :-)

I'm not saying it is possible to move to an other language. Just look at Paypal they moved their customer-facing code from Java to node.js and got a very large productivity increase: http://www.youtube.com/watch?v=V5yk5SZxWX4

Obviously the reason Paypal choose node.js are similar to why Facebook choose PHP: quick iterations, means more iterations, which means more experimentation and better results.

Re: Hack: a new programming language for HHVM

#336
post #170

Earlier quoted context omitted.

PHP is a "crumbling foundation" in exactly the same way DOS, Windows, COBOL, and C and C++ were, are, "crumbling foundations". I don't see how you are disagreeing with me. You are proving the point. You aren't actually going to claim that Windows was well-conceived and theoretically well-founded, are you? Windows has been a never ending refinement on exceptionally shaky ground.

I'm appalled and little bit insulted that you group PHP in the same group with COBOL, C and C++ in terms of their foundation. COBOL and C were designed by some of the greatest pioneers of the field, and indeed PHP is built on C.

C designers choose deliberately to ignore the other system level programming languages at the time, which already offered more memory safe constructs, in their quest for a portable macro assembler.

PHP could have been easily done in any language with native compiler toolchains.

Re: Hack: a new programming language for HHVM

#337

Earlier quoted context omitted.

I am not trying to belittle efforts necessary for the state of the art VM or programming language implementation. I get paid to do these stuffs, and I am on my third VM/PL project now. It is also true these things take time and not very parallelizable, so while man-month may not be that big, you can't make it faster by throwing more people. On the other hand, I maintain it still is no big deal compared to rewriting F…

If they're wasting money on bad management decisions, they're wasting stockholder money. They're also continuing to propagate an outwardly facing engineering culture that will make it even harder to hire people to help dig them out of the PHP hole -- perpetuating this further. Your argument is simply another take on survivor bias fallacy. > I get paid to do these stuffs, and I am on my third VM/PL project now ... Bec…

What do you consider to be high quality VM? How many do you expect to see and how many do you find?

Adaptive JIT and generational GC would be a good baseline. Limiting myself to open source VM, I think (at least) HotSpot, Mono, V8, JavaScriptCore, PyPy, SBCL, Racket qualify. J9, CLR, Chakra, Allegro CL also qualify, but not open source. SpiderMonkey, LuaJIT, HHVM lack generational GC. All these projects are actively developed, and there are doubtlessly more, e.g. I am not faimilar with Smalltalk VM, some of which are commercial. Research VM like JikesRVM, Maxine qualify. I believe Bartok qualifies too.

I am not sure what you are arguing for. If you are arguing for Quercus route(PHP-on-JVM), I think it's unclear Quercus route is better than HHVM route. If you are arguing for not running existing PHP codebase, I think you are being unrealistic.

Re: Hack: a new programming language for HHVM

#338
post #175

Earlier quoted context omitted.

Because "build atop a crumbling foundation" has demonstrated time and again to be, by far, the most successful way to accomplish anything in computing? I can't imagine where that sort of conclusion comes from. Building on a crumbling foundation seems to be just about the most proven, reliable way to ensure your software project won't survive more than a short time without needing serious effort just to maintain it an…

> Much of the world still runs on C But these days, most interesting applications run on C++, which started from the arguably crumbling foundation (from C++'s point of view, not per se) of C, and grew organically over several major revisions into something hideously complex. This trait of C++ is not a good thing, but the amount of successful software written in it seems to prove that it's not fatal either. > You can…

C++ belongs to my list of languages that I enjoy using, sadly it was build in quicksand foundations due to C compatibility as a way to make it mainstream.

Re: Hack: a new programming language for HHVM

#339
everyone has it's own over the fact that facebook had to use another language rather than php. On the other side there is the fact that facebook managed to get one of the most visited website on top of php, period. This is a and we would never know what would be facebook if it was built on top of another language. Probably they had to shut down early just because they were not able to hire enough developers to keep pace with new stuff and scale. At the same time they haven't suffered the same amount of issues twitter had to deal with (remember the landing whale?) with much less users and traffic just because they were using RoR and that lead them to move to something completely different with scala and a different architecture. But still, facebook has about 4x times users and much more data to deal with (more text, images, video and so on).

Nevertheless, let's remember that web applications are not a one-shop monolithic anymore.

Re: Hack: a new programming language for HHVM

#340
post #85

Earlier quoted context omitted.

> I am baffled as to why you'd build your castle atop a crumbling foundation. Because perfect is not the enemy of the good? Because "build atop a crumbling foundation" has demonstrated time and again to be, by far, the most successful way to accomplish anything in computing? Unless you have some example of perfect, now dominant, technologies that have been created ex nihilo that I'm missing? I mean we (facebook) are…

Given a programming task, it will be written faster, easier, and in a more maintainable and less bug-prone fashion if it is not PHP. The opposite opinion is basically indefensible. Sure, you can still dig a trench with a spoon (and if you have enough money to wield a bunch of workers with a spoon), even if a shovel would do a better job. Let's begin. 1) PHP autocraptastically converts strings that look like numbers,…

[deleted]
Post reply on HN