Hello guyz, I have been wondering over this. How does a PHP-MySQL application fare in compariosn to desktop applications like those written in C or visual basic? I used to think that desktop applications are much faster. But I re-considered it because of the following reasons: 1. The server usually has a RAM of 3-4 GB where as my home PC has only 256 MB. 2. I came across a line at an Softpedia article that read that "Server side programming is widely used in production of high performance applications.". Of course, I am aware that the purpose of server side applications and desktop applications is much different, but I am programming an PHP-MySQL application which I would like to make it functional even from remote places. That why I brought up this question. Thank you. -Rohan
I think php/mysql run faster, because they are created to handle high loads at fastest speeds possible. but you can always argue against that saying so is c i think they are both fast, depending on the efficiency of the coding
Your question is not really clear... Anyway, what do you mean by : "I am programming an PHP-MySQL application which I would like to make it functional even from remote places." ? You mean that if you use the application from any place in the world it should be accessible ? If you put your web application on a server, well it will be available anywhere in the world (where there is Internet of course, and if it's not blocked), and it will be "almost" at the same speed anywhere. If your web application is fast in USA but slow in Japan, it's mostly due to location, bandwith , etc...
Hi Crath, Thanks for your response. Even after searching the internet, I haven't got any authoritative resource, but I got a blog which says that Attention: PHP executes twice as fast when it’s run on ASP.NET. I am not sure if this will help me! Hi Mrmuggles, Thank for your response too. I am actually asking about speed of processing and generating the output. I am aware that the speed at which the output is transferred to the client PCs will depend upon geographic location, bandwidth, etc but I am concerned more about processing speeds. Ah, even these I know are dependent upon the processor! but how will desktop application languages and PHP-MySQL fair on the same machine?
Hm, where to begin on this one. PHP is written in C, so by default, PHP is technically slower than C. The big thing to keep in mind here is the intent of use. Most computers today have 1-2GB ram, I personally have 4gb in my office PC and 2gb in my laptop. If we're talking straight comparison of if you wrote an application in C vs if you wrote an application in PHP (Yes, you can actually write "desktop" software with PHP, I've done it before and it's quite interesting, but not the most proctical application), then C would operate much faster because it has 1 less level to transfer down to the processor. Compiled C/C++ code runs fairly quickly, it gets compiled and it's fairly low-level to the processor (meaning less conversions to get it straight into binary that the machine can read). PHP is written in C, so it operates quickly, but the PHP code has to be read and interpreted before getting passed down. RAM aside, you have to take into account that most desktop applications run a visual with it, which is a big processor use compared to just sending plain text. PHP just sends the HTML code to your browser and your browser puts it into a visual, but most C applications (or applications in general) have to do some preloading, grabbing of configuration options, initial GUI loading, and then it starts running. The biggest thing here is that desktop applications are clientside, which means if it takes .05 seconds longer to process something, you would never know, where as when some of the sites we work on get 300k-500k+ unique visitors a day, those .05 seconds add up quite a bit. Clientside software usually isn't written as "well" as high traffic PHP applications based purely on the fact that most programmers can get away with, not sloppy, but "quicker to write" code than in PHP. If we deliver a PHP project to someone and it goes slow when it starts getting traffic, we're going to get a call, but if we were to deliver a C program that wasn't as optimized as what we would write in PHP, it's still going to operate pretty quickly because it only has to compete with your OS for processing power, where as a server has to compete with everyone else trying to view the site. Lastly, is VisualBasic. It's a terrible, terrible language, which has a number of uses, but most of them is just a matter of time constraints and not needing excellent coding. VisualBasic operates slow by comparison, and any project that is worth doing, is worth doing well: in C/C++ or at least some lower level language than VisualBasic. Sorry the explanation is so long, but I hope that gives you some insight into your question.
It's true that PHP is written in C, but this fact doesn't make PHP slower than C. (Many C compilers is also written in C) PHP is interpreted language, and speed of calculations in PHP in most cases isn't comparable with C. But programming in PHP is easier, faster, and not dependent on platform. Fast executable vs. fast developing.
I'm going to disagree with you on that one. PHP itself just running as a program vs any other C program is not going to really differ on speed, but PHP Is a language in itself, that has to have it's code interpreted and then it gets passed down to the compiled C code, so it has a full extra step that a C program does not, so inherently it has to run slower. Now the question of the efficiency of the actual PHP Source code vs a C program someone else writes is something to take into context, but you have to assume if you write a programming language in language X, then it's going to run slower when compared to a program that doesn't have to do any interpretation that is written in language X. Also, not sure what C compilers have to do with anything, their speed is never a question, you assume it takes some time to compile, so whether it takes 1 minute or 1 year to compile, it is partially dependent on how well the compiler was written as well as what language the compiler was written in, but that is completely outside the scope of the question of if PHP code is comparable to something similar written in C.
This is obvious misunderstanding, I want to point you that PHP isn't slower than C because PHP is written in C, but because PHP is interpreted language(parsing and lexical analysis take some time). Nothing more, just to mention real cause of PHP "speed" isn't programming language (if we take in consideration only compilers which make machine code not some bytecode or similar) but his nature of execution. Take back to the thread...
Hi ProjectShifter, Rile and ZenOswyn. Thanks for all your replies. After reading ProjectShifter's reply, I got some answer in the direction, but Rile's reply again made me wander Thanks for your responses And I will go thorugh that comparison chart by ZenOswyn. Thanks .
Any language that run over memory is at least 400x faster than those which have to access the disk for information. Peace,