diff --git a/Cargo.toml b/Cargo.toml index 688eb9f3..199fbb1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,11 +44,13 @@ default = ["compare"] compare = [] tracing = ["dep:opentelemetry", "dep:opentelemetry-otlp", "dep:opentelemetry-semantic-conventions", "dep:tokio", "dep:tracing", "dep:tracing-opentelemetry", "dep:tracing-subscriber"] +# Optimized build for any sort of release. [profile.release-lto] inherits = "release" lto = true strip = "symbols" +# Profile for performance testing with the "perf" tool. Notably keeps debug enabled and does not strip symbols to make reading the perf output easier. [profile.perf] inherits = "release" lto = true diff --git a/scripts/time_parse.bash b/scripts/time_parse.bash new file mode 100755 index 00000000..0efbbba3 --- /dev/null +++ b/scripts/time_parse.bash @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# Time running a single parse without invoking a compare with emacs. +set -euo pipefail +IFS=$'\n\t' +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +: ${PROFILE:="release-lto"} + +cd "$DIR/../" + +function main { + local additional_flags=() + if [ "$PROFILE" = "dev" ] || [ "$PROFILE" = "debug" ]; then + PROFILE="debug" + else + additional_flags+=(--profile "$PROFILE") + fi + cargo build --no-default-features "${additional_flags[@]}" + time ./target/${PROFILE}/compare +} + +main "${@}"