Click here to Skip to main content
15,881,139 members
Articles / Web Development / HTML

Head-to-head benchmark: C++ vs .NET

Rate me:
Please Sign up or sign in to vote.
4.64/5 (338 votes)
4 Jul 2011LGPL356 min read 1.1M   2.3K   202  
How fast is C++ compared to C#? Let's compare code ported directly between the two languages.
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
#pragma once

// Mysteriously, the default comments beside the following constants in Visual 
// Studio say both that "the minimum required platform is Windows Vista" (WINVER=0x0600)
// AND "the minimum required platform is Windows 98". (0x0500 is Windows 2000)

#ifndef WINVER                // Specifies that the minimum required platform is Windows 2000.
#define WINVER 0x0500
#endif
#ifndef _WIN32_WINNT          // Specifies that the minimum required platform is Windows 2000.
#define _WIN32_WINNT 0x0500
#endif
#ifndef _WIN32_WINDOWS        // Specifies that the minimum required platform is Windows 98.
#define _WIN32_WINDOWS 0x0410
#endif


#define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer None
Canada Canada
Since I started programming when I was 11, I wrote the SNES emulator "SNEqr", the FastNav mapping component, the Enhanced C# programming language (in progress), the parser generator LLLPG, and LES, a syntax to help you start building programming languages, DSLs or build systems.

My overall focus is on the Language of your choice (Loyc) initiative, which is about investigating ways to improve interoperability between programming languages and putting more power in the hands of developers. I'm also seeking employment.

Comments and Discussions