MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / churn32

Function churn32

engine/3rdparty/stb/tests/test_ds_cpp.cpp:258–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256
257typedef struct { int n[8]; } str32;
258void churn32(int a, int b, int count, int include_startup)
259{
260 struct { str32 key; int value; } *map=NULL;
261 int i,j,n;
262 str32 key = { 0 };
263 for (i=0; i < a; ++i) {
264 key.n[0] = i;
265 hmput(map,key,i+1);
266 }
267 if (!include_startup)
268 dont_measure();
269 for (n=0; n < count; ++n) {
270 for (j=a; j < b; ++j,++i) {
271 key.n[0] = i;
272 hmput(map,key,i+1);
273 }
274 assert(hmlen(map) == b);
275 for (j=a; j < b; ++j) {
276 key.n[0] = i-j-1;
277 hmdel(map,key);
278 }
279 assert(hmlen(map) == a);
280 }
281 measure();
282 hmfree(map);
283 churn_inserts = i;
284 churn_deletes = (b-a) * n;
285 dont_measure();
286}
287
288typedef struct { int n[32]; } str256;
289void churn256(int a, int b, int count, int include_startup)

Callers 1

mainFunction · 0.70

Calls 2

dont_measureFunction · 0.70
measureFunction · 0.70

Tested by

no test coverage detected