Skip to content

Instantly share code, notes, and snippets.

@rpgmaker
Created October 11, 2013 21:15
Show Gist options
  • Save rpgmaker/6942142 to your computer and use it in GitHub Desktop.
Save rpgmaker/6942142 to your computer and use it in GitHub Desktop.
Test("Regular Loop", () =>
{
var itemx = GetList(list, list2);
});
Test("Regular Loop2", () =>
{
var itemx = GetList2(list, list2);
});
Test("Linq", () =>
{
var itemx = (
from x in list
join y in list2 on x.ID equals y.ID
select new DataHolder { x = x, y = y }
).ToList();
//var ik = "";
});
static void Test(string name, Action action)
{
var sw = new Stopwatch();
sw.Start();
for (var i = 0; i < MAX_COUNT; i++)
{
action();
}
sw.Stop();
Console.WriteLine("Completed {0} in {1} Millisecond(s)", name, sw.ElapsedMilliseconds);
}
@rpgmaker
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment