| 110 | } |
| 111 | |
| 112 | void RunSpeedTests() |
| 113 | { |
| 114 | #ifdef SPEED_TEST |
| 115 | #ifdef RUN_GC_TESTS |
| 116 | const char *testGarbageCollection = |
| 117 | "import std.random;\r\n\ |
| 118 | import std.io;\r\n\ |
| 119 | import std.gc;\r\n\ |
| 120 | int memStart = GC.UsedMemory();\r\n\ |
| 121 | \r\n\ |
| 122 | class A\r\n\ |
| 123 | {\r\n\ |
| 124 | int a, b, c, d;\r\n\ |
| 125 | A ref ra, rb, rrt;\r\n\ |
| 126 | }\r\n\ |
| 127 | int count;\r\n\ |
| 128 | long oldms;\r\n\ |
| 129 | typedef A ref Aref;\r\n\ |
| 130 | A ref[] arr;\r\n\ |
| 131 | \r\n\ |
| 132 | A ref Create(int level)\r\n\ |
| 133 | {\r\n\ |
| 134 | if(level == 0)\r\n\ |
| 135 | {\r\n\ |
| 136 | return nullptr;\r\n\ |
| 137 | }else{\r\n\ |
| 138 | A ref a = new A;\r\n\ |
| 139 | arr[count] = a;\r\n\ |
| 140 | a.ra = Create(level - 1);\r\n\ |
| 141 | a.rb = Create(level - 1);\r\n\ |
| 142 | if (count > 0) {\r\n\ |
| 143 | a.rrt = arr[rand(count - 1)];\r\n\ |
| 144 | }\r\n\ |
| 145 | ++count;\r\n\ |
| 146 | return a;\r\n\ |
| 147 | }\r\n\ |
| 148 | }\r\n\ |
| 149 | double markTimeBegin = GC.MarkTime();\r\n\ |
| 150 | double collectTimeBegin = GC.CollectTime();\r\n\ |
| 151 | io.out << \"Started (\" << GC.UsedMemory() << \" bytes)\" << io.endl;\r\n\ |
no test coverage detected