Click here to Skip to main content
15,501,276 members
Please Sign up or sign in to vote.
4.67/5 (3 votes)

I'm sick of PHP, I spent almost a month now trying to write a backend for an application which not only is slow, but hard to develop. I once was used to write in PHP, I wrote code for many small sites when I was growing up, but apparently after moving to structured programming, with variable types (WOW!), and sane APIs - where you know intuitively what you'll get in every case, I simply just can't go back.

I'm trying to change that, move the project to a programming language which is more suitable for me (and achieve faster code execution and better performance).

My top candidates are using CGI to run C++ code, or ASP.NET (and attempt to lose the script-like method of coding as much as possible, by exporting the functionality to C#).

My usage needs are simple, JSON data is posted at me (a request), I process the data, and simply "echo" (in PHP terms) a JSON response - so no site development is required from me this time.

My question is: What is more suitable for my needs? I guess that C# development will be much shorter than in C++, what about performance issues? I have seen a performance test that showed that the performances of both the technologies are quite similar, are there any aspects of comparison that I'm missing?

Thanks a lot.

Forget C++, and go for ASP.NET with C#; the difference in performance will be largely negligible. ASP.NET and C# have been designed to work together so your development time will be shortened by using them. There are plenty of samples on the ASP.NET web site[^].
Share this answer
I.explore.code 13-Oct-12 13:29pm    
agreed! +5! moreover the ASP.NET engine itself uses low level APIs that are supposedly optimised for web. so there! :)
Richard MacCutchan 13-Oct-12 13:46pm     CRLF
Isn't that what I said?
I.explore.code 13-Oct-12 14:26pm    
wasn't obvious enough for me!
There are benchmarks strewn all over the internet that seem to suggest that C++ is a much faster language simply because its much closer to the kernel than any other high level languages like C#. But these benchmarks are quite limited, in that, they are run over a small repetitive set of problems that seem to be computation intensive and unless you are building a scientific or mathematical computation system or heavy data system of some kind (like Facebook does), you won't need that high performance because it won't be utilised fully.

That being said, for your purpose which is building a server side program that will plainly echo a JSON string based on a request, C# will give almost comparable performance to C++. ASP.NET engine that runs with IIS uses native APIs written in low level C that are quite optimised for web servers AFAIK. But then again, every use case is different and every technology suits one set of problems more than others.

My recommendation is to start small and build 2, one with C# and the other with C++ and analyse the performance yourself over a period of time. At the end of it and based on your long term usage strategy, pick one that comes out at the top.

I will be glad to be corrected or added to. :)
Share this answer
ShacharK 13-Oct-12 13:11pm    
I'm usually a low-level guy, but I really think that a C++ implementation for this project would be an overkill. By the way, are Visual Studio Ultimate 2010 and IIS sufficient for development of C# for Web-platform? are there any helpful add-ons? Thanks a lot.
I.explore.code 13-Oct-12 13:30pm    
Yes! they ought to be sufficient and it depends how complex of an interaction you want. There are loads of tools available to help you, you can get access to all of them if u install Web Platform Installer from Microsoft.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900