
Saving Money by Switching from PHP to D - pjmlp
https://dlang.org/blog/2019/09/30/saving-money-by-switching-from-php-to-d/
======
not_a_cop75
"Obviously, performance was a big win.  The website felt like it was running on
local machines, bringing a dramatic increase to speed and lower latency across
the board.  After the switch, at first the load on our cloud servers was so low
that we thought the website was down!  Switching from PHP to D meant we could
cut in half the instance size of each Amazon AWS machine in our cloud.  And
these machines are still underloaded.  Our database cloud was highly affected
by this too.  We now use one quarter of its original computational power.  All
of this brought an instantaneous and dramatic cost savings, down to more than
half of what our costs used to be." 

I'm willing to bet they didn't even try a single one of the many possibly
optimizations they could have used and actually stay either in PHP or a subset
of PHP.  It's so much easier to win your argument with a strawman, not to say
there aren't cases where D is, in fact, better. 

[https://stackoverflow.com/questions/1408417/can-you-
compile-...](https://stackoverflow.com/questions/1408417/can-you-compile-php-
code-and-upload-a-binary-ish-file-which-will-just-be-run)

[https://www.keycdn.com/blog/php-performance](https://www.keycdn.com/blog/php-
performance)

~~~
trikko
Author here.  You're wrong.  We did a lot of optimizations over the years :) We
switched to D just because that's not enaugh

~~~
not_a_cop75
I'm wrong?  Then what optimizations did you do?  Please, enlighten me.  I have a
list of methods in the links above, if you don't recall offhand. 

------
skocznymroczny
Do you think most of the improvements came from the language switch, or was
the PHP code so bad that a rewrite allowed for cleaner and fresher
architecture? 

~~~
trikko
Author here.  The language switch did the trick!  Php code was rewritten some
years ago.  And we also ported some backend code to c++ to improve performance. 
Code was not that bad.  Php is :)

~~~
7sigma
It's so bad that you can build multi billion dollar businesses with it

~~~
nobleach
I certainly don't want to get into the "PHP is a fractal of bad design" vs
"PHP is awesome because it runs on a very high percentage of websites,
including Facebook" debate. ( I have no dog in this race, and I have absolutely
no opinion on PHP) But I would ask, are those multi-billion dollar businesses
making that much money DUE to their usage of PHP?  Or could they run on almost
any language/framework and still do just as well?  We've heard the stories like
"Twitter dropped Rails and rewrote their message queue in Scala, and a lot of
their backend in Java"... so I get that there are _some_ scaling stories
regarding languages... I just don't think most success stories can be
attributed to language choice.  Now obviously if you build your entire business
on something obscure, and cannot find any competent developers, that's an
issue....

~~~
7sigma
That's why I said you "can".  As someone who's done c, c++, JavaScript, lisp,
prolog, a bit of python, whenever I see people saying such and such language
is bad (like trikko's comment), it just strikes me as immature.  There are way
bigger factors that determine the success or failure of a project yet somehow
I keep hearing developers fixated with the idea that the language alone will
make or break the project. 

------
Shorel
I have seen similar improvements in my own code migrated from PHP to C++. 
Yeah, no one writes C++ in this century, etc...

~~~
trikko
We did a partial migration to c++ in a previous iteration!