IDependOn-Set: 1
IDependOn-Set: 2
IDependOn-Set: 230
IDependOn-Set: 237
IDependOn-Set: 250
IDependOn-Set: 254
LastModifiedSecs: 931806290
Parent: 230
SequenceNumber: 2
Title: Servlets vs. PHP
Part: 0
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 931806290
Type: monospaced
Lines: 54
----------
From: Cezar Totth <cezar@GENESYS.RO>
To: SERVLET-INTEREST@JAVA.SUN.COM
Subject: Re: Fw: (is servlet really faster?) Php Vs Servlet, unexpected result, why?
Date: Mon, Jul 12, 1999, 2:21 AM


Hi,

PHP might work faster on simple tests because it has a very large,
powerfull library already compiled as native code, so even it is basically
an interpreter, all native-code functions are faster than equivalent
java bytecode.

But the interpreted (PHP's language) libraries you might need to provide
to build will be almost sure slower than java bytecode...

Other advantages of java vs. PHP:

- More powerfull object-oriented language,
- Java better for large projects.
- Lots of libraries,
- Performance can be improved by using faster JVMs
  or faster servlet engines.
- Have not working for long with PHP  but I dont remember it
  keeping session state. (even considering the fact it can run as
  plain CGI)
- Limited number of databases supported.
  Database calls are very much database-dependent, changing database
  used  might  be a lot of pain..

Improvments to servlets on Linux..

- Use a JIT compiler, IBM has a new one,
  follow links at http://alphaworks.ibm.com
  Also the Kaffe JVM from http://www.kaffe.org might help.
- !!! Try to measure the performance with the JSDK's provided servlet
  engine. Dont know about jserv1.0b5, but mine jserv0.9.11 was much slower
  than JSDK's engine...
  Don't know if it was due to missconfigurations, but anyway JSDK's
  servlet engine is pretty fast to be used as a ... refference.
- Printing dates in Java may require a lot of CPU resources.
  On some of my tests I found that printing dates may take most %
  from processing a HTTP request. Try to instantiate a DateFormat
  and re-use it to print more than one Date.

  (DateFormat.format(Date) call)
  Otherwise Date.toString(), each time it is called,
  creates locally  a TimeZone and DateFormat instance
  then tell it to format(this).  This is expensive.
------------------

Bye,
Cezar.
EndPart: 0
