From d784cfa0d642d5d507847dfb4c04c582c9186ee1 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Mon, 30 Jan 2023 17:39:29 +0800 Subject: [PATCH] perf: using memcpy in data export --- src/klotski_core/ffi/all_cases.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/klotski_core/ffi/all_cases.cc b/src/klotski_core/ffi/all_cases.cc index 4bba079..e9598de 100644 --- a/src/klotski_core/ffi/all_cases.cc +++ b/src/klotski_core/ffi/all_cases.cc @@ -1,3 +1,4 @@ +#include #include "klotski.h" #include "all_cases.h" @@ -32,7 +33,6 @@ void export_all_cases(uint64_t *buffer) { } void export_basic_ranges(uint32_t *buffer) { - for (const auto &range : BasicRanges::fetch()) { - *(buffer++) = range; - } + auto basic_ranges_ptr = &*BasicRanges::fetch().begin(); + memcpy(buffer, basic_ranges_ptr, BASIC_RANGES_SIZE * 4); // 32-bits -> 4-bytes }