I see a lot of comments that JSP/Java is slow compared to asp/php/asp.net is this true, because I have been on JSP sites like vodaphone or barclaycard and they don’t seem any slower than other sites. Also I occasionally see a comment on here which states that jsp is in fact quicker does anyone have a definitive answer?
Yes, it’s significatly slower, at least according to the benchmarks I’ve seen. It goes something like this:
PHP 43 Pages per second
ASP 42 Pages per second
JSP 13 pages per second
I posted the link in a recent thread about PHP vs. ASP I think. If you look around you may be able to find it. The reason you don’t notice any speed difference is that just 13 pages per second is an AWFUL lot. (edit: It’s 33 million pageviews per month) Most sites won’t reach that.
First of all, a disclaimer: I am in love with all things Java.
I think you will find, though, that if you have a properly tuned server (and are using a fast JSP engine, like Resin), and your code is properly optimised, then the difference between PHP and JSP is quite small. I will admit , though, that optimising a JSP script is somewhat difficult, because, for example, you have to make sure that you are using the fastest database drivers, and there are several different ways of doing each thing, instead of one. Whereas in PHP, it’s mostly just inbuilt functions.
I imagine those tests were done with a “hello, world” script, and they counted the initial compilation time of the JSp into their average. Any self-respecting JSP programmer would have pre-compiled his jsp…
Anyway, JSP isn’t that much slower than anyone else, and don’t let those benchmarks fool you: it’s still the best.
going based purely on personal experience, JSP is much slower… I don’t ever recall visiting a *.jsp page without it taking quite a long time to execute
Anyway, JSP isn’t that much slower than anyone else, and don’t let those benchmarks fool you: it’s still the best.
I don’t want to burst your bubble… But just saying that JSP is the best won’t make it.
I take it that means you didn’t read the rest of my post?
Well, I have seen very conflicting statements here. Fatpiper, while you seem very knowledgable and trustworthy, I’m trusting benchmarks more than one mans opinion. The benchmarks I’m talking about did take precompilation into account, if I remember correctly.
Also, I just now noticed that the subject also included the question on whether ASP.NET is faster than JSP, and about that, there is no argument.
Take a look at this article at Gotdotnet.com. It implements the Pet store application released by Sun as a best-practices blueprint application for java, using C# and .NET, and they concluded that it was 28 times faster, and implemented in 1/4 of the code. Even IF we assume a HUGE bias and an incredible amount of lies, it’s still very impressive.
Originally posted by M. Johansson
[B]Also, I just now noticed that the subject also included the question on whether ASP.NET is faster than JSP, and about that, there is no argument.
Take a look at this article at Gotdotnet.com. It implements the Pet store application released by Sun as a best-practices blueprint application for java, using C# and .NET, and they concluded that it was 28 times faster, and implemented in 1/4 of the code. Even IF we assume a HUGE bias and an incredible amount of lies, it’s still very impressive. [/B]
I have seen this comparsion too, although I believe .net to be quicker the difference is nowhere near what this test makes out. If you study the code you will see that the .net version is totally geared to performance optimisation, where as the java code was actually designed as a learning example and is geared towards portabilty and hardly optimised at all.
For example the .net is optimised for sql server thus it only uses the minimum code for that, plus makes use of stored procedures. The java is set up so it can be used on any database, thus more code slower performance and does not use stored procedures for the same reason, again affecting performance. Basically the java pet store would be much, much quicker than it currently is if was optimised for one database like the .net code and made use of EJBS or the Apache Struts framework rather than normal beans/servlets. Saying that I still think .nets quicker, but by nowhere near the amount stated in that article.
For me JSP is terribly slow. I am pro SUN and JAVA and all but its simply much slower than PHP and even ASP. Every page Ive seen written in JSP takes a lot longer to process. I dont think its comparably as fast as PHP.
This is pretty hard to quantify on the client end of an Internet connection though.
That bench mark was done on jsp that wasn’t compiled. The first time you load a jsp app, it will take longer to load. After that it should be quit a bit faster then 13 pages per load.
my experience with JSP pages are that they’re noticeably slower than PHP, ASP, ColdFusion pages in general… but i’ve read that JSP pages are slower the first time they’re run as they need to be compiled, and also when any changes are made to the source code… if as lfabbric says, the JSP pages were run for the first time, then it probably isn’t really fair… AFAIK, JSP pages which have already been accessed and compiles run very fast… that’s some justification for Sun’s claims about JSP’s speed…
well anyway, i’ll be doing a project with JSP very soon at work and i’ll see how it goes… i’ve to admit though that JSP is a much harder language to code in than PHP or ColdFusion but that’s for another discussion
In my experience, the speed of optimised applications running in their ideal environment goes something like: .NET, PHP, ASP, CFM, JSP.
As was pointed out before though, even the speed differences are really minimal, most users would hardly notice unless the code was unoptimised or was not running in the ideal environment.
I was just talking to a CFM junkie the other day and he started in about how CFM is just as fast if you run it optimised and I just looked at him and asked him if he thought I wrote all my ASP and .NET stuff unoptimised. Every coder should be running stuff optimised, and most serious benchmarks do this.
JSP isn’t an inferior language by any stretch. It’s not my language of choice, and I wouldn’t recommend it to the people I’m working with, but that doesn’t mean it can’t pull it’s weight. I’ve seen some incredibly fast JSP sites, just like I’ve seen some insanely slow PHP sites. There are simply too many variables to say “this language is best” or “this language is worst”.
Two thoughts on the matter :
- From what I’ve seen developers who use Perl, CGI, mostly go to PHP. Visual Basic developers go with Microsoft. Java programmers goto J2EE. The point being if you know VB you don’t need to learn Java to develop applications.
- Any Professional JSP developer would Pre-Compile his scripts. So you wouldn’t have such lagg at first.
Originally posted by kennyisnotdead
[list]
[]From what I’ve seen developers who use Perl, CGI, mostly go to PHP. Visual Basic developers go with Microsoft. Java programmers goto J2EE. The point being if you know VB you don’t need to learn Java to develop applications.
[]Any Professional JSP developer would Pre-Compile his scripts. So you wouldn’t have such lagg at first.
[/list]
i do agree with you on both points, esp. the first… most people move on to a language whose syntax and structure are familiar to them or similar to languages they already know… but i’m stating the obvious :)… still, sometimes you do not have a choice as to what language you have to use, especially at work where there’re particular languages the company only uses as a standard policy-like thing…
as for pre-compiling, yes a ‘Professional’ developer would… but sometimes you just forget to especially when you’re only making minor changes to the source code… not to mention pre-compiling is a chore too…