Ask HN: What web language for server side scripting?
I know this gets asked a lot, but some input on our specific situation would be appreciated, considering we don't have: a) experience with one of the languages already or b) bit of an app already coded.
For a dynamic web-based solution, what language would you recommend?
Some Criteria:
1) The languages we are thinking about are php, python, perl, ruby we are open to other suggestions, don't have enough experience in any of them to make a difference.
2) We value speed of execution most.
3) We are going to use postgres for a database.
4) Webhost compatibility is not an issue. You're going to have to define what sort of speed you need for #2. If you're talking about basic CRUD, then all of the languages you've specified will work just fine. If you're doing a lot of scientific work, then you might want to look at Python, along with NumPy / SciPy. If it's a small core of calculations that you know you'll have to execute over and over again, then all of the above are fine if you're happy to interop with C. So... whatcha building? If you do stick with Perl, they have a NumPy/SciPy equivalent called PDL. I, personally, prefer Ruby because it thinks the same way I do (if that makes sense). So that's what I'd pick. But Python would do you just as well, if you like the way it reads, etc. better. They key, I think, is to not be too worried about speed up front. Get your thing working in Python, say, and then do testing (another comment mentioned this) and rewrite what's slowest in C. I guess I'm warning against premature optimization. (Co-founder) well we are/aren't trying to prematurely optimize. It's more like 4 great languages to choose (depending on option) and we don't really know enough to pick and learn one. So we're polling to find out if there is really something that we should with a few requirements. Like we care more about how fast the code runs than the speed of coding.But generally not to the excess of writing in C (etc). In my opinion, Python, Ruby or Perl are all good choices. You can get things done quickly in PHP, but I would recommend staying away from it as a first language. Honestly, if you care about speed as much as you say you do, you should be looking into Java. (Or Lisp, if you're not worried about hiring any time soon). I myself am a strong proponent of Java. There are enough tools out there that take much of the tediousness of all the common functionality (basic CRUD, form handling, workflow, etc). The real strength of Java presents itself after you've moved to production; I almost always am able to hand somebody an .ear or .war file and completely offload deployment/operations to somebody else. As a plug for EJBs (a lot of the negativity around EJBs are carryoversr from EJB 2.1 and earlier), EJB-based application can be easily scaled by putting a request into operations for an additional app server and administratively changing the number of "processors" (session beans). App server failover and recovery is also fairly transparent as well. Just my $0.02.. Python, of course. #2. Python usually wins: http://www.alrond.com/en/2007/jan/25/performance-test-of-6-l... #3. Django was written with Postgres in mind. And Python can be easily extended with C or even Assembly. Here's the story of the guy who successfully optimized web app bottlenecks in C:
http://fi.am/entry/the-limits-of-django-the-answers/ If speed of execution is a key requirement, beyond C++ and some good programmers, your main options are Java and C#. I use Java with Struts on Tomcat for a couple of projects and it's served me well. I was thinking that too, but perhaps he means 'execution' in the more generic sense of creating a product quickly? In any case, even with a slow scripting language like Ruby, if the speed of the language is a concern, perhaps that part of the application should just be farmed out to a library in C (or a separate process in whatever language). Need more info, though. I'm the Ops Co-founder. True C like languages are faster, but we don't need quite that much speed. nothing Scientific, or really mission critical. I mostly want the code to run faster vs ease of coding. So if the app was going to take longer running in php than python, but faster to code, I would still want python. Agree. Speed of execution != scripting language. If speed really is key i'd say Perl, otherwise I would just stick to PHP. Ruby and Python are nice for writing code really fast in but Perl / PHP execute much faster. Are you sure about PHP being faster than python? Unscientific as it could be, this test shows speeds comparable or better for python: http://shootout.alioth.debian.org/gp4/benchmark.php?test=all... [lines going right are better for python, the ones going left are better for php] I don't mean to bring this as proof of any sort, but also according to my own experience python scripts outperform php ones. i think that i didn't think that thought all the way through. sorry about that We use Ruby on Rails for the web app, and our sys admin scripts are written in Ruby as well, as they can easily integrate with our DB via our Rails setup. If you want speed, why not Common Lisp? Nice, high-level, a pleasure to work in, fast and compiled out of the box, with the ability to optimize the hell out of specific critical parts of your code (using, e.g., optional type declarations, speed and safety settings, inlining declarations, etc.). Hunchentoot is a nice web server, Postmodern is a nice library for working with Postgres. Python, reasons follow: 1) Django
2) App Engine
3) Highly expressive Or Pylons @ pylonshq.com is a better alternative to Django for most projects. Ruby on Rails or Django. python