Speed Question

Eloff

Freshman
Joined
Mar 20, 2003
Messages
35
Location
Canada
I've 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, doesn't count the time to compile it.

So I'm 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 don't think I'd 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, I'm sure you'd 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 it's run). After that, every request for the page calls the compiled code. So you don't need to worry about compile time.

Whatever language you use with the .NET framework makes no difference, they're all about the same speed. Some prefer C# because it closely resembles Java/C++ (it's sort of a mix between them in terms of syntax), and others prefer VB because they're coming from VB6 and learning the new .NET framework. On a side note, C# does offer a couple of features that VB doesn't have, but that's for a different topic entirely. It shouldn't matter in the slightest for what you're 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 I've 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 it's all part of the .NET framework and all the code is basically the same no matter if you're programming a windows application or web application. It's good stuff.

Just to be fair, though, I haven't run any benchmarks to compare PHP and ASP.NET speed. But since ASP.NET is compiled I have no doubt it'll 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
 
philprice said:
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 don't see how this makes PHP a bad language.
 
PHP is a bit of a mess - I think there's about 1500 functions built in to the language, which aren't grouped together effectively. Also it can't use COM, which discounts it from a great deal of business applications.
 
PHP is indeed a very messy language internally, but that doesn't
mean your code can't 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 we're using now is built in PHP. :)

All that aside, I think ASP.NET is the clear leader for web languages now.
 
That's true, except for the somewhat lacking support for it that many
hosts have. I'd say php is probably the most popular as of right now.
 
The application isn't a really a web application, so I've 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 it's 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, we'll 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, I'd 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.
 
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.
 
I'm 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.
 
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).. what's the difference? All you do with importing is add more functions to your program. With PHP they're already there for you. If you don't need to use a function, don't use it. What's the problem?

As for clean.. scripting languages period aren't 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 doesn't work at all with apache?
 
Back
Top