mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
add benchmark to CI
This commit is contained in:
parent
768b92c3a5
commit
28244f1a2d
@ -1,4 +1,27 @@
|
||||
#include <benchmark/benchmark.h>
|
||||
#include "gtest/gtest.h"
|
||||
extern "C" {
|
||||
#include "PikaMain.h"
|
||||
#include "PikaStdLib_MemChecker.h"
|
||||
#include "dataArgs.h"
|
||||
#include "dataMemory.h"
|
||||
#include "pikaScript.h"
|
||||
}
|
||||
|
||||
static void BM_for_continue(benchmark::State& state) {
|
||||
for (auto _ : state) {
|
||||
PikaObj* pikaMain = newRootObj((char*)"pikaMain", New_PikaMain);
|
||||
/* run */
|
||||
obj_run(pikaMain, (char*)
|
||||
"a = 0\n"
|
||||
"for i in range(0, 1000):\n"
|
||||
" if i == 5:\n"
|
||||
" continue\n"
|
||||
" a = a + i\n"
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_for_continue);
|
||||
|
||||
BENCHMARK_MAIN();
|
@ -1,4 +1,5 @@
|
||||
rm build/test/pikascript_test
|
||||
sh make.sh
|
||||
build/test/pikascript_test
|
||||
build/benchmark/pikascript_benchmark
|
||||
#build/test/pikascript_test --gtest_filter=args_*
|
||||
|
@ -432,7 +432,7 @@ TEST(pikaMain, for_if_continue) {
|
||||
pikaMemInfo.heapUsedMax = 0;
|
||||
PikaObj* pikaMain = newRootObj((char*)"pikaMain", New_PikaMain);
|
||||
/* run */
|
||||
obj_runDirect(pikaMain, (char*)
|
||||
obj_run(pikaMain, (char*)
|
||||
"a = 0\n"
|
||||
"for i in range(0, 10):\n"
|
||||
" if i == 5:\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user