Skip to content

Instantly share code, notes, and snippets.

@NikolayIT
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NikolayIT/0b8422cb4cc8f9930f52 to your computer and use it in GitHub Desktop.
Save NikolayIT/0b8422cb4cc8f9930f52 to your computer and use it in GitHub Desktop.
Compare a += b with a = a + b
using System;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
int a = 0;
int b = 1;
Stopwatch sw = new Stopwatch();
sw.Start();
for (int i = 0; i < 100000000; i++)
{
a += b;
// a = a + b;
}
Console.WriteLine(sw.Elapsed);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment