Skip to content

Instantly share code, notes, and snippets.

View ArcticEcho's full-sized avatar
👋
I'll get round to it, eventually.

Sam ArcticEcho

👋
I'll get round to it, eventually.
View GitHub Profile
@ArcticEcho
ArcticEcho / Stack vs Heap Benchmark
Last active August 29, 2015 14:02
Updated M1 vs updated M2.
// M1 is 108% faster than M2.
public static unsafe void TestMethod1()
{
float* samples = stackalloc float[12500];
for (var i = 0; i < 4000; i++)
{
for (var ii = 0; ii < 12500; ii++)
{
var leave = false;
while (someCondition && !leave)
{
System.Threading.Thread.Sleep(500);
Application.Current.Dispatcher.Invoke(new Action(() =>
{
if (someOtherCondition)
{
namespace C_Sharp_Benchmarker
{
class Program
{
private static int testIterations = 10000000;
public static void Main(string[] args)
{
var t1 = Test1();
var t2 = Test2();