From 71c31046c6f977eab2b34017f2f56e2f736d75ae Mon Sep 17 00:00:00 2001 From: Taewoon Kim Date: Sun, 1 Nov 2026 03:11:26 +0900 Subject: [PATCH] native: build the image at -O3 (#159) On GraalVM CE 25.4.4.1.1 -O3 is not the same as -O2 (the pom.xml comment said it was). Timed laptop A/B, -O3 against -O2 at -march=compatibility: the four warm figures have a geometric mean of 0.736, document ingest 0.852, graph ingest 0.884, peak RSS unchanged; the library is 1.62x larger and the build takes 1.43x as long. -march=x86-64-v3 gave no gain worth a second library, so the wheel keeps -march=compatibility. NATIVE_IMAGE in _build_info records -O3. Closes #159 Co-Authored-By: Claude Opus 5.5 --- native/pom.xml | 2 +- native/scripts/build-image.sh | 4 ++-- native/wheel/build_wheel.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/native/pom.xml b/native/pom.xml index cd0d1c10..83d1166b 100644 --- a/native/pom.xml +++ b/native/pom.xml @@ -14,7 +14,7 @@ 26.10.2 25.0.2 - + -Os 1.1.14 25 diff --git a/native/scripts/build-image.sh b/native/scripts/build-image.sh index afebba63..606181cc 100755 --- a/native/scripts/build-image.sh +++ b/native/scripts/build-image.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build the native image (the shared library the `arcadedb` wheel ships): GraalVM CE 25.4.4.1.1, -O2, FFM unbound Highway +# Build the native image (the shared library the `arcadedb` wheel ships): GraalVM CE 25.4.4.1.1, -O3, FFM unbound Highway # handle (fastops.mode 1), -H:-VectorAPISupport (CE crash oracle/graal#14751), engine jars of the pinned RELEASE (arcadedb.version, from # Maven Central, never a local SNAPSHOT), local symbols deleted (the default: a smaller image than the phase 7/8 profiling builds). # MARCH (default compatibility = baseline x86-64, what a manylinux wheel promises, PEP 600; x86-64-v3 is the GraalVM CE 25.4 default and the faster reference). @@ -34,7 +34,7 @@ export JAVA_HOME=$G PATH=$G/bin:$PATH export NATIVE_IMAGE_OPTIONS="-J-Dfastops.mode=1 -J-Xmx$XMX -H:-VectorAPISupport -march=$MARCH${NI_EXTRA:+ $NI_EXTRA}" cd "$WT/native" rm -f "target/$LIBFILE" "$OUT/$LIBFILE" -./mvnw -B --no-transfer-progress -f pom.xml -DskipTests -Darcadedb.version="$ENGINE" -Dgraalvm.version=25.4.4.1.1 -Dnative.opt=-O2 package > "$OUT/build.log" 2>&1 +./mvnw -B --no-transfer-progress -f pom.xml -DskipTests -Darcadedb.version="$ENGINE" -Dgraalvm.version=25.4.4.1.1 -Dnative.opt=-O3 package > "$OUT/build.log" 2>&1 # Windows: the Maven plugin hands native-image its arguments in an @args file that it deletes at exit, so build.log has no # "native-image -cp --shared" line, which gen_notices.py reads. Append one: the glue jar plus the runtime classpath that # dependency:build-classpath resolves with the same properties (checked on Linux: the same 59 jars as the logged classpath, plus the glue jar). diff --git a/native/wheel/build_wheel.py b/native/wheel/build_wheel.py index c07c96d0..01122116 100644 --- a/native/wheel/build_wheel.py +++ b/native/wheel/build_wheel.py @@ -238,7 +238,7 @@ def sub(m): (dst / "_build_info.py").write_text( f'"""Written by native-wheel/build_wheel.py."""\n' f'ENGINE_VERSION = "{a.engine}" # the ArcadeDB engine release compiled into {libname}\n' - f'NATIVE_IMAGE = "GraalVM CE 25.4.4.1.1, -O2, -march={a.march}"\n' + f'NATIVE_IMAGE = "GraalVM CE 25.4.4.1.1, -O3, -march={a.march}"\n' f'NATIVE_MARCH = "{a.march}" # lib.py checks the CPU only for an x86-64-v3 image\n' f'SOURCE_COMMIT = "{commit}" # ArcadeData/arcadedb-python commit of the bindings and the Java glue\n', encoding="utf-8",