Click here to Skip to main content
15,891,316 members
Articles / Desktop Programming / ATL

A statistical analysis of the performance variations of assorted managed and unmanaged languages

,
Rate me:
Please Sign up or sign in to vote.
3.92/5 (59 votes)
8 Aug 2002CPOL11 min read 365.1K   1.3K   45  
This article compares and contrasts the relative performances of various languages like native C++, Visual Basic 6, C#, VB.NET, Managed C++, MC++ and native code mix, ngen'd assemblies etc. using a prime number generation function as a generic benchmark
// MCPPPrimes2.h

#pragma once

using namespace System;
using namespace System::Runtime::InteropServices;

void UnmanagedComputePrimes(int* primes, int numPrimes);

namespace MCPPPrimes2
{
	[ComVisible(true)]
	[ProgId("MCPPPrimes2.ComputePrimes")]
	[Guid("9D9A36F4-67B5-4529-86FE-C5AA58E315B7")]
	[ClassInterface(ClassInterfaceType::None)]
	public __gc class MCPPPrimes2 : public ATLPrimes::Interop::IComputePrimes
	{
	public:
		int primes __gc[];

		MCPPPrimes2()
		{
		}

		void CalculatePrimes(int numPrimes)
		{
			primes = new int __gc[numPrimes];
			int __pin* rgPrimes = &primes[0];

			UnmanagedComputePrimes(rgPrimes, numPrimes);
		}
	};
}

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 Code Project Open License (CPOL)


Written By
United States United States
Nish Nishant is a technology enthusiast from Columbus, Ohio. He has over 20 years of software industry experience in various roles including Chief Technology Officer, Senior Solution Architect, Lead Software Architect, Principal Software Engineer, and Engineering/Architecture Team Leader. Nish is a 14-time recipient of the Microsoft Visual C++ MVP Award.

Nish authored C++/CLI in Action for Manning Publications in 2005, and co-authored Extending MFC Applications with the .NET Framework for Addison Wesley in 2003. In addition, he has over 140 published technology articles on CodeProject.com and another 250+ blog articles on his WordPress blog. Nish is experienced in technology leadership, solution architecture, software architecture, cloud development (AWS and Azure), REST services, software engineering best practices, CI/CD, mentoring, and directing all stages of software development.

Nish's Technology Blog : voidnish.wordpress.com

Written By
Architect
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions