MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / doit

Function doit

test/benchmark/test_zlib_benchmark.c:16–39  ·  view source on GitHub ↗

don't inline, to be friendly to js engine osr

Source from the content-addressed store, hash-verified

14
15// don't inline, to be friendly to js engine osr
16void __attribute__ ((noinline)) doit(unsigned char *buffer, int size, int i) {
17 static unsigned char *buffer2 = NULL;
18 static unsigned char *buffer3 = NULL;
19
20 unsigned long maxCompressedSize = compressBound(size);
21
22 if (!buffer2) buffer2 = (unsigned char*)malloc(maxCompressedSize);
23 if (!buffer3) buffer3 = (unsigned char*)malloc(size);
24
25 unsigned long compressedSize = maxCompressedSize;
26 compress(buffer2, &compressedSize, buffer, size);
27 if (i == 0) printf("sizes: %d,%d\n", size, (int)compressedSize);
28
29 unsigned long decompressedSize = size;
30 uncompress(buffer3, &decompressedSize, buffer2, (int)compressedSize);
31 assert(decompressedSize == size);
32 if (i == 0) {
33 if (strcmp((char*)buffer, (char*)buffer3) != 0) {
34 puts("incorrect output!");
35 abort();
36 }
37 puts("output looks good");
38 }
39}
40
41int main(int argc, char **argv) {
42 int size, iters;

Callers 1

mainFunction · 0.70

Calls 6

printfFunction · 0.85
strcmpFunction · 0.85
putsFunction · 0.85
mallocFunction · 0.50
assertFunction · 0.50
abortFunction · 0.50

Tested by

no test coverage detected