3 ms·
The link you yourself cite shows a fourfold speed advantage for procedural PHP over ROR. Not mentioned is the large memory footprint of a Rails process compare
by idlewords 17y ago
The link you yourself cite shows a fourfold speed advantage for procedural PHP over ROR. Not mentioned is the large memory footprint of a Rails process compared to a procedural PHP page. It's the usual phenomenon of trading off development time and complexity for performance. I'm sure if you wrote a web app in C, it would run even faster.
Rasmus's point in the article is that as soon as you move away from simple apps under light load into real applications, it is no longer enough just to rely on Rails magic. You find yourself needing to understand the innards of what is a very complex environment, and dealing with an idiosyncratic development community that considers monkey-patching a neat programming techinique, and likes to publish its documentation in video format.
He doesn't seem to me to be saying 'don't use Rails'. He's just pointing out you should be fully aware of what you're getting into. Caveat scriptor.
- dasil003 17y agoRasmus's point in the article is that as soon as you move away from simple apps under light load into real applications, it is no longer enough just to rely on Rails magic. This seems backwards to me. I consider PHP to be ideal for simple apps. Rails comes with a certain amount of overhead (memory being the most important as far as cost is concerned), therefore I think it's only really useful for applications of a certain complexity. What makes Rails useful are some basic architectural assumptions (MVC + a bunch of low level assumptions / web helpers) that are surprisingly applicable to a large chunk of web apps. The magic is just some Ruby tricks to streamline things, but you don't "rely on it". Where Rails tends to fall down are limitations of the Ruby runtimes, or applications where the web front-end is not a significant enough part of the problem to warrant the Rails approach. PHP is similar in some ways--it includes many web-based assmptions, but it doesn't make any architectural assumptions, which means there is no way to benefit from common conventions (eg. knowing where to look for a certain file or class definition, what a variable or database table should be named, where is the default place to put certain types of logic, etc). As such, PHP is better than any other raw language for web work, but it doesn't really allow you to easily utilize best practices that we've collectively learned over the last 15 years of web development. That's not to say Rails is just plain better... to the contrary, I think PHP is a better templating language. The difference is that with PHP you are better off moving to a real language for your back-end on any moderately complex application fairly quickly. Rails, on the other hand, will let a significant portion of web apps (if not a majority) go quite far without any separate back-end.
- nostrademons 17y agoBut as soon as you move away from simple apps under light load into real applications, it is no longer enough just to rely on PHP magic. You find yourself needing to understand the innards of what is a very complex environment, and dealing with an idiosyncratic development community that considers ad-hoc exposure of C libraries a neat programming techinique, and likes to publish its documentation as comments on a web page. ;-) PHP occupies an unfortunate middle-ground: it's less productive than Rails or Django, but less performant than C++. If your site really gets to Google- or EBay- or Facebook- or Twitter-scale, it's probably worth rewriting it in C++. PHP, Python, and Ruby all have fairly easy-to-use C interfaces, so it's not that hard to link in the performance critical parts later as you rewrite them. Given that PHP isn't an effective final solution anyway, why not start with something a bit more sane?
- idlewords 17y agoPHP isn't an effective final solution? Yahoo uses it as the front-end language for tons of stuff.
- nostrademons 17y agoRuby on Rails isn't an effective solution? Twitter uses it as the front-end language for tons of stuff.
- idlewords 17y agoIt's not. Twitter ended up having to move the guts of the service off Rails to handle growth, back when it was a small fraction of the size of a typical Yahoo property. Also, the comparison doesn't really make much sense. ORM is at the heart of Rails, and the framework has a very intimate relationship with a backing data store. At a company like Yahoo, PHP is used as a kind of presentation layer that communicates with various backend services that do the heavy lifting. It's a different architectural model, designed to avoid precisely the kind of problems you get scaling Rails (or Django, or your favorite framework).
- 17y ago
- petercooper 17y agoThe link you yourself cite shows a fourfold speed advantage for procedural PHP over ROR. Not mentioned is the large memory footprint of a Rails process compared to a procedural PHP page. Apples and oranges. Why not compare plain PHP to plain Ruby to be fair? and likes to publish its documentation in video format. Hardly a negative point. The screencasts are one of the reasons Rails became so popular in the first place.
- idlewords 17y agoI'd love to see a memory/speed comparison of vanilla PHP and Ruby. I don't think it would be very flattering to Ruby, but I'd be happy to be wrong.
- petercooper 17y agoMaybe not, but PHP code tends to be of lower quality. It'd be like comparing a Lego house to a real one. You can build a Lego house quicker, but so what?
- petercooper 17y agoJust wanted to note, before I piss anyone off, my tongue was firmly in cheek on that post ;-)