MCPcopy Create free account
hub / github.com/WheretIB/nullc / RunSpeedTests

Function RunSpeedTests

tests/TestSpeed.cpp:112–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void RunSpeedTests()
113{
114 #ifdef SPEED_TEST
115#ifdef RUN_GC_TESTS
116const char *testGarbageCollection =
117"import std.random;\r\n\
118import std.io;\r\n\
119import std.gc;\r\n\
120int memStart = GC.UsedMemory();\r\n\
121\r\n\
122class 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\
127int count;\r\n\
128long oldms;\r\n\
129typedef A ref Aref;\r\n\
130A ref[] arr;\r\n\
131\r\n\
132A 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\
149double markTimeBegin = GC.MarkTime();\r\n\
150double collectTimeBegin = GC.CollectTime();\r\n\
151io.out << \"Started (\" << GC.UsedMemory() << \" bytes)\" << io.endl;\r\n\

Callers 1

RunTestsFunction · 0.85

Calls 2

randFunction · 0.85
UsedMemoryMethod · 0.45

Tested by

no test coverage detected