text
stringlengths
0
1.17k
[299.36 --> 305.42] plus plus they have these massive documents that describe um what syntax should look like what's
[305.42 --> 309.94] valid grammar that sort of thing and we've been talking about it i'm i'm sorry i'm going to say we
[309.94 --> 313.54] and us in a lot of different contexts today i'm going to try and keep track of which context that
[313.54 --> 319.90] is um we the php community um have been talking for a lot of years about how we kind of need to
[319.90 --> 327.00] formalize what the language is you know we need to say all right these are the behaviors you should
[327.00 --> 334.26] expect from the parser and and what uh a script a well-written script actually looks like as opposed
[334.26 --> 339.18] to having two different ways of doing if statements that look completely different or whatever it happens
[339.18 --> 344.72] to be um so it's always been like yeah we should do that we should do that we should do that but who
[344.72 --> 349.14] wants to write documentation right none of the programmers i don't want to write documentation
[349.14 --> 356.68] so fast forward years and years and years facebook's got this hhvm thing that we've built for
[356.68 --> 362.46] uh running face learning facebook code very fast and hopefully other people's php code very fast
[362.46 --> 369.54] um and we're thinking well what can we do to give back really because like facebook was built on php it
[369.54 --> 375.08] was built on the public version of php you know zuck sitting in his dorm room putting together the first
[375.08 --> 382.72] facebook.net or whatever um was just running regular php um funnily enough probably some code that i wrote in
[382.72 --> 390.64] there um that's kind of cool yeah no he's my boss go figure um so what can we do to to give back and show
[390.64 --> 396.48] that we're serious about taking the php language seriously you know we want php to be seen as a
[396.48 --> 403.30] better language instead of the fractal of bad design so we said well here's something that not
[403.30 --> 408.44] only has the community sort of been asking for this and hoping that they can put together a spec properly
[408.44 --> 414.84] but this will actually help hhvm at the same time because we want to be able to write a parser that is
[414.84 --> 421.20] fully compliant with php but how do we do that if we don't know what php is apart from looking at the
[421.20 --> 427.04] source code so it's not a completely selfless gesture either so let's so we pause there for just a second
[427.04 --> 434.68] maybe um for those listening and kind of catching up um real quick mention what is hhvm oh of course
[434.68 --> 442.00] i'm sorry um hhvm stands for hip-hop virtual machine um it's the basically third generation of
[442.00 --> 450.76] a compiler that facebook's been working on to uh to run php code it's um ostensibly uh php syntax
[450.76 --> 458.50] compatible um the the problem we ran into about five years ago or so at this point is that um php's
[458.50 --> 465.50] code base is massive and we have a couple of users so we need to be able to run that php as fast as
[465.50 --> 473.60] possible uh changing to another language is possible but it is obviously a large task we have
[473.60 --> 480.08] something like 10 to the seventh lines of code um that's not a small project very big wow uh yeah
[480.08 --> 484.18] very big i remember reading about your choice of mercurial versus get to and it was you know the
[484.18 --> 489.54] choice between those two version controls was also based on how larger larger code base was and how many
[489.54 --> 496.80] developers have committing to it on a daily basis too yeah no so our our main code base of php um i
[496.80 --> 501.46] don't touch it often i'm mostly touching c plus plus code but sometimes i go ahead and touch the the php
[501.46 --> 508.22] repo and if i'm doing the checkout on git because we we're still supporting both modes at the moment
[508.22 --> 516.76] um i can say git pull and then i'll walk away you know go down have lunch uh check myself in the
[516.76 --> 522.28] america all the time right come back but a long time is the point yeah um i do it on mercurial and
[522.28 --> 530.48] i just say hg update and done and now it's done it is blazingly faster we might need to earmark that
[530.48 --> 535.50] topic just just for the listeners sake because i know we covered that on the changelog um i know it's
[535.50 --> 540.08] a big deal anytime facebook makes choices and it sort of provides this rift for others to follow in the
[540.08 --> 545.38] community because because of your sheer size and also because of your engineering team and the talent you
[545.38 --> 550.64] have you know you obviously tend to have a pretty good opinion any pretty definitive opinion that
[550.64 --> 556.90] sort of provides this divide to the community and we covered uh just quickly your your um your choice
[556.90 --> 561.40] of mercurial over git and i thought it was just enlightening the reasons why you chose it
[561.40 --> 566.58] yeah and there's more reasons than just speed um and i'm not going to go into all those because
[566.58 --> 571.84] that's actually not my area of expertise and i'll probably get some things wrong um i do just want
[571.84 --> 576.54] to say that i have a lot of love for git i don't want to poop on git about saying it's slower than
[576.54 --> 582.50] mercurial in all cases it's it was a decision that facebook made because our code base particularly
[582.50 --> 590.08] needed um uh speed to get developer efficiency up um and that's developer efficiency is one of our
[590.08 --> 597.02] watch words when it comes to what we want to focus on um focus on 10 to the 7th lines of code that is
[597.02 --> 602.50] just astounding yeah yeah you know you have a lot you know you have a large app when you consider
[602.50 --> 607.58] you know reworking the underpinnings less work than actually you're rewriting in a separate language
[607.58 --> 612.18] well really i mean that that's what it comes down to it's like what's what's going to be easier
[612.18 --> 617.76] rewriting in another language or making the language better right can you give us maybe a snapshot too of
[617.76 --> 624.66] the importance of hhvm to facebook because i remember reading uh um and help me piece this together
[624.66 --> 629.86] this is totally up um you know off the cuff here but i remember reading a blog post about and i can't
[629.86 --> 633.70] remember the names of who's involved so you could probably even name them if you'd like to but it was
[633.70 --> 637.64] basically like down to the wire of getting this done or you'd have to like do something massive to
[637.64 --> 643.20] get this just-in-time virtual machine in place to kind of read php code and from what i can understand
[643.20 --> 648.96] basically decompile that down to binary or something other way some other way of doing it was like this
[648.96 --> 653.54] big deal and it was like down to the minute and a five-year-long project and finally you had cracked it
[653.54 --> 660.08] can you kind of give a snapshot of that of that moment um that might be slightly dramatic dramatized
[660.08 --> 665.80] for internet effect i'm not sure okay because it seemed dramatic to me i i will certainly say that
[665.80 --> 671.04] you know when we when we started building the hip-hop project um which initially by the way was not a
[671.04 --> 677.88] virtual machine or or a just-in-time compiler it was actually a a php to c++ transpiler um when we
[677.88 --> 684.00] first got that project going we actually were sort of hitting the limits of how much blood we could
[684.00 --> 690.10] squeeze out of the php turnip for our code base and the number of users we had um we literally could
[690.10 --> 696.18] not buy hardware fast enough to be able to serve up every user that wanted to hit the site um so
[696.18 --> 702.68] in in that sense it was probably a bit of a crunch time it was it was a bit of um god what are we going
[702.68 --> 709.62] to do do we need to train everybody to write c++ code and get this thing uh running at at real speeds
[709.62 --> 715.36] are we going to pick up i don't know compiled python or something like that i don't know um
[715.36 --> 721.18] consider the undertaking when you have that many engineers working on that much code
[721.18 --> 730.26] um how long is that going to take um turned out the uh the process of transpiling php to p to c++ code
[730.26 --> 736.94] at the very base of it wasn't all that difficult um i don't want to take it away from him from uh
[736.94 --> 744.50] high ping who wrote the first version of of hip-hop but um the the basic of of just doing that bits of
[744.50 --> 750.72] transpiling uh got us a huge performance win i think it was like an 80 win right off the bat and it came
[750.72 --> 757.02] to like a two and a half times win within like a year or something like that um that's a huge gain
[757.02 --> 763.38] when you can run um two and a half times fewer servers right absolutely um and that just gives
[763.38 --> 772.88] you that breathing room to say oh thank god oh you know um that ultimately uh led to the vm project
[772.88 --> 777.52] because we looked at this transpiler option and we said well this has got a bunch of problems with it
[777.52 --> 782.88] number one our developer environment now looks nothing like a production environment and it can't
[782.88 --> 787.42] because you can you imagine as a developer if you make one tiny change to a little php file
[787.42 --> 794.24] you then have to recompile all of these millions of lines of code just to see what difference comes
[794.24 --> 799.48] out on your web page you would run screaming from that yes what what was the compile time do you
[799.48 --> 810.66] recall like um so uh i i yeah i can say that number sorry i was trying to decide if i could say that
[810.66 --> 817.80] number um at the time that we switched off of the transpiler onto the vm um i want to say it took
[817.80 --> 823.86] about 20 minutes to build the entire site but that's not on a single machine that's actually on a fleet of
[823.86 --> 828.68] machines because we're using just cc to do this wow i think if you tried to do this on a single machine
[828.68 --> 835.42] um it would be like you know a day's process or something like that it was definitely not something
[835.42 --> 841.62] that developers could do so developers uh for a while wound up doing just regular php because it's
[841.62 --> 847.88] close enough but then we started adding functionality to the language like generators for example we've had
[847.88 --> 856.72] for years and php just got them uh in version 5.5 so uh we had these sort of hacks in place like hphpi
[856.72 --> 861.18] which was uh slower than regular php but it worked for development purposes
[861.18 --> 866.70] and and things like that and it was it was just kind of messy it led to some weird inconsistencies
[866.70 --> 875.36] between dev and production excuse me um so that led off the the vm project um and we we had a bunch
[875.36 --> 881.76] of guys who who came from microsoft uh at that time uh they've worked on the clr um so they've built
[881.76 --> 888.02] you know just in time compilers before recently in fact um so they brought a lot of that uh information
[888.02 --> 895.18] to bear and that um i think i think that kicked off somewhere around like 09 something like that
[895.18 --> 901.36] slightly before we actually released hip-hop to the world in 2010 um but it didn't really
[901.36 --> 911.12] hit the point of running production code until uh january of 2013 so it took a while to get that one right
[911.12 --> 918.40] if i can maybe do a call back to our last show too jared um i want to make a note i guess to kind
[918.40 --> 922.92] of i guess go from where we are to talking about the php spec and what it's actually written and it's