Speed Question

Eloff

Active member
Joined
Mar 20, 2003
Messages
35
Location
Canada
Ive written a fairly intensive app that uses a mysql database. About 1000 lines of code with maybe 15-20 sql queries, and some data manipulation, including regular expressions.

Now I used php (an interpreted language) for this and I get an execution time of a little over 1/3 of a second on my Pentium IV. That, of course, doesnt count the time to compile it.

So Im wondering if it would be worthwhile to rewrite it in a .net language and compile it? Visual basic would be easiest, but would it be seriously slower in my situation than C# or C++? I know that C languages are usually very fast, but I dont think Id be doing anything really low-level anyway. Hoping you guys might be able to help me make a decision here. Also should I rewrite it in a .net language which would be better to use, ODBC or OLE-DB/ADO? I think ADO is easier, but is ODBC maybe faster? Or would it not really matter?

Thanks for your time, any input is welcome:)

Dan
 
If you switched for MySql to MS SQL, used stored procedures, and converted the PHP code to ASP.NET, Im sure youd get a much faster execution time. Not to mention your source code will be way more organized and readable. :)

ASP.NET only compiles the code once (the first time its run). After that, every request for the page calls the compiled code. So you dont need to worry about compile time.

Whatever language you use with the .NET framework makes no difference, theyre all about the same speed. Some prefer C# because it closely resembles Java/C++ (its sort of a mix between them in terms of syntax), and others prefer VB because theyre coming from VB6 and learning the new .NET framework. On a side note, C# does offer a couple of features that VB doesnt have, but thats for a different topic entirely. It shouldnt matter in the slightest for what youre doing (I seriously doubt you need bit shifting, pointers, or operator overloading for a web project)

I programmed PHP/MySql for about three years back in the day when it was still fairly new. Recently Ive been toying with ASP.NET (I was never a big fan of ASP, mind you). I have no honestly say, ASP.NET just destroy PHP. Especially since its all part of the .NET framework and all the code is basically the same no matter if youre programming a windows application or web application. Its good stuff.

Just to be fair, though, I havent run any benchmarks to compare PHP and ASP.NET speed. But since ASP.NET is compiled I have no doubt itll be faster. And, well, MS SQL > MySql period.
 
Just a little thing, PHP is really a rubbish language - sorry but it has to be said, dont get me wrong im not "free software" bashing, (i love perl / mysql) but its got friggin mysql_*() methods built into the core of the language! /rant
 
i think PHP is a great language for what it is ive made many complex apps and was very happy with the results in speed and functionality that PHP gives

Right ive said it!

Andy
 
Originally posted by philprice
Just a little thing, PHP is really a rubbish language - sorry but it has to be said, dont get me wrong im not "free software" bashing, (i love perl / mysql) but its got friggin mysql_*() methods built into the core of the language! /rant

It has those methods built into the language because PHP was built entirely on the idea of using it with MySql. I dont see how this makes PHP a bad language.
 
PHP is a bit of a mess - I think theres about 1500 functions built in to the language, which arent grouped together effectively. Also it cant use COM, which discounts it from a great deal of business applications.
 
PHP is indeed a very messy language internally, but that doesnt
mean your code cant be well organized; you can create classes
and whatnot and organize your code that way.

Also, I think PHP is going to be able to use .NET components in the
future. And divil, PHP does have COM support in it somewhere.

[edit]COM functions in PHP[/edit]
 
Despite some folks not liking PHP for one reason or another, its hard to deny the raw power of it. Google is proof of such power that resides within it. Even the forums were using now is built in PHP. :)

All that aside, I think ASP.NET is the clear leader for web languages now.
 
Thats true, except for the somewhat lacking support for it that many
hosts have. Id say php is probably the most popular as of right now.
 
The application isnt a really a web application, so Ive settled on using C# for it (and I get to learn a cool new programing language out of the bargain:).

Wyrd, there is an application called ionCube accelerator for php that supposedly goes one step further than the "dynamic compilation" of ASP.NET. Check it out http://www.php-accelerator.co.uk/, and its free to boot. (I found it after reading your post and doing some searches on google). That should make the speed question fairly moot between ASP.NET and php, but ASP.NET is probably a nicer language should you find a good host for it. (and any way to intmate otherwise on a .NET forum is suicide;).
 
Well, the .NET framework is free too. :)

As for speed.. well, well let the benchmarks tell the story when someone is brave enough to actually perform some with PHP and ASP.NET. :) Even if ASP.NET turns out to be 5% slower, Id still use it. The elegance of an OOP language over a function driven one is beyond words. Not to mention ASP.NET also brings RAD along with it.
 
True, although php is a really nice language for those simple web projects, 200 lines of code or less.
 
200? I bet I could do it in ASP.NET with 5... :) Just throw some controls on the page, flip a few properties, and done! Heh. ASP.NET RAD is just too nice.
 
Im going to have to give that asp a try:) I have an apache web server on my win 2k machine, will asp work with that?
 
If you have a win2k machine, you have Microsoft IIS already on there, and can use ASP pages right out of the box.
 
Quite true.

Insert your windows 2k pro disk wait for autoload click on Additional and IIS is in there

Andy
 
PHP is a mess, im saying have mysql_* built in along with the 1000s of other functions in the BASE of language is bad practice. .NET is a much for sofisticated language and im sure it doesnt have that many base functions. These should be kept to a minumum and the programmer can import what he/she has to use making for more lightweight base and only specific stuff used.

I know PHP developers feel this way as there as been numerous "hacks" to develop this stucture (PEAR i think), and no matter how hard ive tried with php its never been clean and tidy to program in. Sorry my view /rant
 

PHP is a mess, im saying have mysql_* built in along with the 1000s of other functions in the BASE of language is bad practice. .NET is a much for sofisticated language and im sure it doesnt have that many base functions. These should be kept to a minumum and the programmer can import what he/she has to use making for more lightweight base and only specific stuff used.


Heh.. built into the core language or allow users to import (like C for example).. whats the difference? All you do with importing is add more functions to your program. With PHP theyre already there for you. If you dont need to use a function, dont use it. Whats the problem?

As for clean.. scripting languages period arent clean as they all mix in with HTML code.
 
<-- hates IIS. I used to have IIS installed but I find apache much nicer to work with. ASP.NET doesnt work at all with apache?
 
Back
Top