Eloff Posted March 31, 2003 Posted March 31, 2003 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 Quote
wyrd Posted March 31, 2003 Posted March 31, 2003 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. Quote Gamer extraordinaire. Programmer wannabe.
philprice Posted March 31, 2003 Posted March 31, 2003 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 Quote Phil Price� Visual Studio .NET 2003 Enterprise Edition Microsoft Student Partner 2004 Microsoft Redmond, EMEA Intern 2004
a_jam_sandwich Posted March 31, 2003 Posted March 31, 2003 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 Quote Code today gone tomorrow!
wyrd Posted March 31, 2003 Posted March 31, 2003 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. Quote Gamer extraordinaire. Programmer wannabe.
*Gurus* divil Posted March 31, 2003 *Gurus* Posted March 31, 2003 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* Volte Posted March 31, 2003 *Experts* Posted March 31, 2003 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] Quote
wyrd Posted March 31, 2003 Posted March 31, 2003 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. Quote Gamer extraordinaire. Programmer wannabe.
*Experts* Volte Posted April 1, 2003 *Experts* Posted April 1, 2003 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. Quote
Eloff Posted April 2, 2003 Author Posted April 2, 2003 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;). Quote
wyrd Posted April 2, 2003 Posted April 2, 2003 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. Quote Gamer extraordinaire. Programmer wannabe.
Eloff Posted April 2, 2003 Author Posted April 2, 2003 True, although php is a really nice language for those simple web projects, 200 lines of code or less. Quote
wyrd Posted April 2, 2003 Posted April 2, 2003 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. Quote Gamer extraordinaire. Programmer wannabe.
Eloff Posted April 2, 2003 Author Posted April 2, 2003 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? Quote
a_jam_sandwich Posted April 2, 2003 Posted April 2, 2003 Normall asp yes via Chillisoft ASP or Apache ASP see chilli soft or apache web sites for info Andy Quote Code today gone tomorrow!
*Gurus* divil Posted April 2, 2003 *Gurus* Posted April 2, 2003 If you have a win2k machine, you have Microsoft IIS already on there, and can use ASP pages right out of the box. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
a_jam_sandwich Posted April 2, 2003 Posted April 2, 2003 Quite true. Insert your windows 2k pro disk wait for autoload click on Additional and IIS is in there Andy Quote Code today gone tomorrow!
philprice Posted April 2, 2003 Posted April 2, 2003 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 Quote Phil Price� Visual Studio .NET 2003 Enterprise Edition Microsoft Student Partner 2004 Microsoft Redmond, EMEA Intern 2004
wyrd Posted April 2, 2003 Posted April 2, 2003 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. Quote Gamer extraordinaire. Programmer wannabe.
Eloff Posted April 2, 2003 Author Posted April 2, 2003 <-- 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? Quote
*Gurus* divil Posted April 2, 2003 *Gurus* Posted April 2, 2003 No, I don't think so. MS released WebMatrix which is a free IDE for ASP.NET development, and comes with a webserver written entirely in .NET that supports ASP.NET, if you're desperate. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Gurus* Derek Stone Posted April 3, 2003 *Gurus* Posted April 3, 2003 It will if you install mod_aspnet provided by the Mono Project. Development is ongoing, so I can't guarantee if it works correctly. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.