Skip to content

Native image: -O3 is faster than -O2 on GraalVM CE (warm geomean 0.736), at 1.62x the library size #159

Closed

Description

@tae898

The native image is built at -O2 (native/scripts/build-image.sh, -Dnative.opt=-O2), and the comment in native/pom.xml says that on GraalVM CE -O2 and -O3 are the same. On CE 25.4.4.1.1 they are not: -O3 builds a different, larger image, and it is faster.

Timed A/B on a Linux x86-64 laptop (the rule was written before the run; ab.py --noise, ABBA rounds, round 0 dropped, an A/A control that came out clean), the same engine and glue built at -O2 and at -O3, both at -march=compatibility; below 1 means -O3 is faster or smaller:

figure -O3 / -O2 95% CI clean pairs
warm point lookups 0.875 [0.868, 0.887] 12
warm aggregation 0.670 [0.667, 0.673] 12
warm Cypher 2-hop 0.832 [0.825, 0.837] 12
warm mixed 0.602 [0.601, 0.603] 12
document ingest 0.852 [0.850, 0.854] 17
graph ingest 0.884 [0.878, 0.891] 17
peak RSS, warm 1.003 [0.995, 1.055] 12
peak RSS, ingest 1.005 [1.003, 1.008] 17

The four warm figures have a geometric mean of 0.736. The cost: the library is 158.4 MiB against 97.9 MiB (1.62x) and image generation takes 1.45x as long (3 min 24 s against 2 min 21 s). -march=x86-64-v3 was measured in the same run and gave no gain worth a second library, so the wheel keeps -march=compatibility.

Proposal: build the native image at -O3 on every platform, fix the pom.xml comment, and record -O3 in arcadedb._build_info.NATIVE_IMAGE.

Edited 2026-11-01: the library sizes and the build-time ratio first came from a stale image table (the old pin's builds); corrected to the images the timed run used. The speed figures are unchanged.

Activity

  1. tae898 commented on Nov 1, 2026

    @tae898
    CollaboratorAuthor

    Correction, edited in place above: the library sizes and the build-time ratio came from a stale table of the older builds. The images the timed run actually used are 158.4 MiB (-O3) against 97.9 MiB (-O2), so 1.62x, and image generation took 3 min 24 s against 2 min 21 s, so 1.45x (it said 1.43x). The speed figures are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions