2022-01-04 00:16:43 +08:00
|
|
|
#include <benchmark/benchmark.h>
|
2022-01-04 00:29:11 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
extern "C" {
|
|
|
|
#include "PikaMain.h"
|
|
|
|
#include "PikaStdLib_MemChecker.h"
|
|
|
|
#include "dataArgs.h"
|
|
|
|
#include "dataMemory.h"
|
|
|
|
#include "pikaScript.h"
|
|
|
|
}
|
2022-01-04 00:16:43 +08:00
|
|
|
|
2022-01-04 09:12:32 +08:00
|
|
|
static void for_loop_10000(benchmark::State& state) {
|
2022-01-04 00:29:11 +08:00
|
|
|
for (auto _ : state) {
|
|
|
|
PikaObj* pikaMain = newRootObj((char*)"pikaMain", New_PikaMain);
|
|
|
|
/* run */
|
2022-01-04 09:33:24 +08:00
|
|
|
obj_run(pikaMain, (char *)
|
|
|
|
"a = 0\n"
|
|
|
|
"for i in range(0, 10000):\n"
|
|
|
|
" a = a + 1\n"
|
|
|
|
"\n");
|
2022-01-04 00:29:11 +08:00
|
|
|
}
|
|
|
|
}
|
2022-01-04 09:12:32 +08:00
|
|
|
BENCHMARK(for_loop_10000);
|
2022-01-04 00:16:43 +08:00
|
|
|
|
|
|
|
BENCHMARK_MAIN();
|