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

Function doit

test/benchmark/test_lzma_benchmark.c:60–77  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

58
59// don't inline, to be friendly to js engine osr
60void __attribute__ ((noinline)) doit(char *buffer, int size, int i) {
61 static char *buffer2 = NULL;
62 static char *buffer3 = NULL;
63
64 unsigned long maxCompressedSize = size * 2 + 10000; // whatever
65
66 if (!buffer2) buffer2 = (char*)malloc(maxCompressedSize);
67 if (!buffer3) buffer3 = (char*)malloc(size);
68
69 int64_t compressedSize = lzbench_lzma_compress(buffer, size, buffer2, maxCompressedSize, 4 /*level*/, 0, NULL);
70
71 if (i == 0) printf("sizes: %d,%d\n", size, (int32_t)compressedSize);
72
73 int64_t roundTrip = lzbench_lzma_decompress(buffer2, compressedSize, buffer3, size, 0, 0, NULL);
74
75 assert(roundTrip == size);
76 if (i == 0) assert(strcmp(buffer, buffer3) == 0);
77}
78
79int main(int argc, char **argv) {
80 int size, iters;

Callers 1

mainFunction · 0.70

Calls 6

lzbench_lzma_compressFunction · 0.85
printfFunction · 0.85
lzbench_lzma_decompressFunction · 0.85
strcmpFunction · 0.85
mallocFunction · 0.50
assertFunction · 0.50

Tested by

no test coverage detected