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

Function sum_int_benchmark

test/embind/embind_benchmark.cpp:354–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354void __attribute__((noinline)) sum_int_benchmark() {
355 volatile float t = emscripten_get_now();
356 volatile int r = 0;
357 for (int i = 0; i < 100000; ++i) {
358 r += sum_int(i,2,3,4,5,6,7,8,9);
359 r += sum_int(i,2,3,4,5,6,7,8,9);
360 r += sum_int(i,2,3,4,5,6,7,8,9);
361 r += sum_int(i,2,3,4,5,6,7,8,9);
362 r += sum_int(i,2,3,4,5,6,7,8,9);
363 r += sum_int(i,2,3,4,5,6,7,8,9);
364 r += sum_int(i,2,3,4,5,6,7,8,9);
365 r += sum_int(i,2,3,4,5,6,7,8,9);
366 r += sum_int(i,2,3,4,5,6,7,8,9);
367 r += sum_int(i,2,3,4,5,6,7,8,9);
368 }
369 volatile float t2 = emscripten_get_now();
370 printf("C++ sum_int 100000 iters: %f msecs.\n", (t2-t));
371}
372
373void __attribute__((noinline)) sum_float_benchmark() {
374 volatile float f = 0.f;

Callers 1

mainFunction · 0.85

Calls 2

printfFunction · 0.85
emscripten_get_nowFunction · 0.50

Tested by

no test coverage detected