some nice little micro-benchmarks
[mono.git] / mono / benchmark / readonly-inst.cs
diff --git a/mono/benchmark/readonly-inst.cs b/mono/benchmark/readonly-inst.cs
new file mode 100644 (file)
index 0000000..ec257d9
--- /dev/null
@@ -0,0 +1,23 @@
+using System;
+
+class A {
+       class B { public readonly C c = new C (); }
+       class C { public readonly D d = new D (); }
+       class D { public readonly E e = new E (); }
+       class E { public readonly int i = 1; }
+       
+       static readonly A foo = new A ();
+       static readonly A bar = new A ();
+       
+       readonly B b = new B ();
+       static int Main ()
+       {
+       
+               for (int i = 0; i < 50000000; i++) {
+                       if (foo.b.c.d.e.i != bar.b.c.d.e.i)
+                               return 1;
+               }
+               
+               return 0;
+       }
+}
\ No newline at end of file