Repository Public BSD-3-Clause
1#!/bin/sh2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : ORIX Maps8# File : Infrastructure/package-builder/bench.sh9# Module : Infrastructure10# Repository : https://git.spboucher.ai/orix-maps11# Created : 2026-11-2512# Last Modified : 2026-11-2513#14# Author : Simon-Pierre Boucher15# Position : Professor of Finance16# Institution : Université du Québec en Outaouais (UQO)17# Organization : SP Boucher18# Website : https://spboucher.ai19# Git : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License : Proprietary, all rights reserved (see license file)32# License File : LICENSE33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Measures package build, verification and installation on synthetic data.42# usage: ./bench.sh <private key file> <trust store json> <work dir>43# Builds packages of about 50 MB and 300 MB (pseudo-random components behind a valid PMTiles header), then runs44# `orix-package verify` and `orix-package install` three times each under /usr/bin/time -l.45set -eu46KEY=$1; TRUST=$2; WORK=$347HERE=$(cd "$(dirname "$0")" && pwd)48swift build -c release --package-path "$HERE" >/dev/null49OP="$HERE/.build/release/orix-package"50mkdir -p "$WORK"5152run() { # label map search routing53 n=$154 "$OP" fixture --kind pmtiles --size "$2" --out "$WORK/map-$n.pmtiles" >/dev/null55 "$OP" fixture --kind blob --size "$3" --seed 2 --out "$WORK/search-$n.sqlite" >/dev/null56 "$OP" fixture --kind blob --size "$4" --seed 3 --out "$WORK/routing-$n.orixgraph" >/dev/null57 echo "== $n MB =="58 "$OP" build --region "bench-$n" --name-en "Bench $n" --name-fr "Banc $n" --data-version 1 \59 --data-timestamp 2026-11-24T00:00:00Z --map "$WORK/map-$n.pmtiles" --search "$WORK/search-$n.sqlite" \60 --routing "$WORK/routing-$n.orixgraph" --licences "$HERE/licences-osm.json" --key "$KEY" \61 --out "$WORK/bench-$n.orixmap" | grep -E "size|built"62 for i in 1 2 3; do63 /usr/bin/time -l "$OP" verify "$WORK/bench-$n.orixmap" --trust "$TRUST" 2>&1 \64 | grep -E "verified in|maximum resident|peak memory" | tr -s ' ' | tr '\n' ';'; echo65 done66 for i in 1 2 3; do67 rm -rf "$WORK/store-$n"68 /usr/bin/time -l "$OP" install "$WORK/bench-$n.orixmap" --store "$WORK/store-$n" --trust "$TRUST" 2>&1 \69 | grep -E "installed in|maximum resident|peak memory" | tr -s ' ' | tr '\n' ';'; echo70 done71}7273run 50 30000000 10000000 1000000074run 300 180000000 60000000 6000000075