1# Copyright (c) 2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14set(WARMUP 50000) 15set(ITERS 100000) 16 17set(HEAVY_RUN OFF) 18if (HEAVY_RUN) 19 set(WARMUP 500000) 20 set(ITERS 1000000) 21endif() 22 23list(APPEND BENCHMARKS 24 "voidPasser" 25 "numPasser" 26 "strPasser" 27 "arrPasser" 28 "arrGetter" 29 "strGetter" 30 "objGetter" 31 "numGetter" 32) 33 34list(APPEND EXTRA_BENCHMARKS_STS_JS 35 "arrAnyGetter" 36 "strAnyGetter" 37 "numAnyGetter" 38) 39 40list(APPEND SITES 41 "JS" 42 "STS" 43) 44 45add_custom_target(ets_interop_js_perf_benchmarks) 46 47macro(add_ets_interop_js_benchmark BENCHMARK CALLER CALLEE) 48 panda_ets_interop_js_test(ets_interop_js_perf_benchmarks_${CALLER}_${CALLEE}_${BENCHMARK} 49 NODE_OPTIONS "--jitless" 50 ETS_SOURCES ${CMAKE_CURRENT_LIST_DIR}/caller.sts ${CMAKE_CURRENT_LIST_DIR}/callee.sts 51 JS_LAUNCHER ${CMAKE_CURRENT_LIST_DIR}/launcher.js 52 LAUNCHER_ARGS ${BENCHMARK} ${CALLER} ${CALLEE} ${WARMUP} ${ITERS} 53 ) 54 add_dependencies(ets_interop_js_perf_benchmarks_${CALLER}_${CALLEE} ets_interop_js_perf_benchmarks_${CALLER}_${CALLEE}_${BENCHMARK}) 55endmacro() 56 57foreach(CALLER ${SITES}) 58 foreach(CALLEE ${SITES}) 59 add_custom_target(ets_interop_js_perf_benchmarks_${CALLER}_${CALLEE}) 60 foreach(BENCHMARK ${BENCHMARKS}) 61 add_ets_interop_js_benchmark(${BENCHMARK} ${CALLER} ${CALLEE}) 62 endforeach() 63 foreach(BENCHMARK ${EXTRA_BENCHMARKS_${CALLER}_${CALLEE}}) 64 add_ets_interop_js_benchmark(${BENCHMARK} ${CALLER} ${CALLEE}) 65 endforeach() 66 add_dependencies(ets_interop_js_perf_benchmarks ets_interop_js_perf_benchmarks_${CALLER}_${CALLEE}) 67 endforeach() 68endforeach() 69 70add_dependencies(ets_interop_js_perf_tests ets_interop_js_perf_benchmarks) 71