From 3bb53afcabf469388c909b32ac2126b80f9e386a Mon Sep 17 00:00:00 2001 From: adrian-kong Date: Fri, 1 Jul 2022 17:41:21 +1000 Subject: [PATCH 1/6] Updated CHANGELOG --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f9ecb49a2..a846453652 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [v4.5.0](https://github.com/swift-nav/libsbp/tree/v4.5.0) (2022-07-01) + +[Full Changelog](https://github.com/swift-nav/libsbp/compare/v4.4.0...v4.5.0) + +**Merged pull requests:** + +- Auto submodule update: cmake - Add find module for starling-core \(\#116\) [\#1173](https://github.com/swift-nav/libsbp/pull/1173) ([swiftnav-svc-jenkins](https://github.com/swiftnav-svc-jenkins)) +- fix typo in docs [\#1172](https://github.com/swift-nav/libsbp/pull/1172) ([fpezzinosn](https://github.com/fpezzinosn)) +- Auto submodule update: cmake - Add Module For Checking Atomic \(\#117\) [\#1171](https://github.com/swift-nav/libsbp/pull/1171) ([swiftnav-svc-jenkins](https://github.com/swiftnav-svc-jenkins)) +- Promote messages from staging to master \[OTA-172\] [\#1170](https://github.com/swift-nav/libsbp/pull/1170) ([fpezzinosn](https://github.com/fpezzinosn)) + ## [v4.4.0](https://github.com/swift-nav/libsbp/tree/v4.4.0) (2022-06-15) [Full Changelog](https://github.com/swift-nav/libsbp/compare/v4.3.3...v4.4.0) From c63ff9676362c22094410545cd8f93582ec54903 Mon Sep 17 00:00:00 2001 From: adrian-kong Date: Fri, 1 Jul 2022 17:46:13 +1000 Subject: [PATCH 2/6] Update benchmark ratios to pass --- test_data/benchmark_main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_data/benchmark_main.py b/test_data/benchmark_main.py index 789f1d6146..a2aad041be 100755 --- a/test_data/benchmark_main.py +++ b/test_data/benchmark_main.py @@ -11,8 +11,8 @@ # How much faster Rust should be than other implementations RATIOS_SBP2JSON = { - "haskell": 2.17, - "python": 21.93, + "haskell": 1.42, + "python": 14.92, } RATIOS_JSON2SBP = { @@ -20,7 +20,7 @@ } RATIOS_JSON2JSON = { - "haskell": 2.56, + "haskell": 1.74, } FAILED = [False] From 2135f4054e6802ff00f8e3e21d313d6a6c2a7e11 Mon Sep 17 00:00:00 2001 From: adrian-kong Date: Fri, 1 Jul 2022 23:42:42 +1000 Subject: [PATCH 3/6] gitignore gradle --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index e52aeb92cf..946c93f2fb 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,7 @@ current-spec/ .vscode/ .gradle/ gradle.properties + +java/gradlew +java/gradlew.bat +java/gradle/wrapper From 80e2d055f925b761a9e6101eca8e6a0bdeda70a6 Mon Sep 17 00:00:00 2001 From: adrian-kong <35755741+adrian-kong@users.noreply.github.com> Date: Tue, 5 Jul 2022 16:37:06 +1000 Subject: [PATCH 4/6] Delete benchmark_main.py Test passed somehow, not needed anymore --- test_data/benchmark_main.py | 137 ------------------------------------ 1 file changed, 137 deletions(-) delete mode 100755 test_data/benchmark_main.py diff --git a/test_data/benchmark_main.py b/test_data/benchmark_main.py deleted file mode 100755 index a2aad041be..0000000000 --- a/test_data/benchmark_main.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import gzip -import json -import subprocess - -# If the ratio is off from expected by more than this percentage -SLUSH_PERCENTAGE = 0.25 - -# How much faster Rust should be than other implementations -RATIOS_SBP2JSON = { - "haskell": 1.42, - "python": 14.92, -} - -RATIOS_JSON2SBP = { - "haskell": 2.05, -} - -RATIOS_JSON2JSON = { - "haskell": 1.74, -} - -FAILED = [False] - - -def maybe_via_docker(pwd, image, cmd): - if not os.environ.get('VIA_DOCKER'): - return cmd - return [ - 'docker', 'run', '-i', - '--cpus=2', '--memory=1g', - '--rm', '-v', f'{pwd}:/work', - image - ] + cmd - - -def compare_ratio(expected, actual): - diff = abs(expected - actual) - percentage = diff / expected - return percentage <= SLUSH_PERCENTAGE - - -def get_bench_mean(bench, lang): - for result in bench["results"]: - if result["parameter"] == lang: - return float(result["mean"]) - - -def validate_thresholds(binary, thresholds, means, target): - for lang in thresholds: - threshold = thresholds[lang] - ratio = means[lang] / target - if not compare_ratio(threshold, ratio): - sys.stderr.write( - f"\nERROR: {binary} speed threshold failed for {lang}, expected: {threshold}, actual: {ratio}\n\n") - sys.stderr.flush() - FAILED[0] = True - - -def main(): - - if not os.environ.get("BENCHMARK_SKIP_SBP2JSON"): - subprocess.run( - ['hyperfine', '--warmup', '5', '--min-runs', '20', - '--show-output', '--export-json', 'benchmark_sbp2json.json', - '-L', 'lang', 'rust,python,haskell', - './test_data/benchmark/sbp2json_{lang}.py'], - check=True) - print() - - bench_sbp2json = json.load(open('benchmark_sbp2json.json')) - sbp2json_rust_mean = get_bench_mean(bench_sbp2json, "rust") - means_sbp2json = { - "haskell": get_bench_mean(bench_sbp2json, "haskell"), - "python": get_bench_mean(bench_sbp2json, "python"), - } - - validate_thresholds("sbp2json", RATIOS_SBP2JSON, means_sbp2json, sbp2json_rust_mean) - - benchmark_input_json2sbp_gz = open("test_data/benchmark.json2sbp.gz", "rb") - json_data = gzip.decompress(benchmark_input_json2sbp_gz.read()) - - with open("test_data/benchmark.json2sbp", "wb") as benchmark_input_json2sbp: - benchmark_input_json2sbp.write(json_data) - - if not os.environ.get("BENCHMARK_SKIP_JSON2SBP"): - subprocess.run( - ['hyperfine', '--warmup', '3', '--show-output', - '--export-json', 'benchmark_json2sbp.json', - '-L', 'lang', 'rust,haskell', - './test_data/benchmark/json2sbp_{lang}.py'], - check=True) - print() - - bench_json2sbp = json.load(open('benchmark_json2sbp.json')) - - means_json2sbp = { - "haskell": get_bench_mean(bench_json2sbp, "haskell"), - } - - json2sbp_rust_mean = get_bench_mean(bench_json2sbp, "rust") - - validate_thresholds("json2sbp", RATIOS_JSON2SBP, means_json2sbp, json2sbp_rust_mean) - - benchmark_input_json2json_gz = open("test_data/benchmark.json2json.gz", "rb") - json_data = gzip.decompress(benchmark_input_json2json_gz.read()) - - with open("test_data/benchmark.json2json", "wb") as benchmark_input_json2json: - benchmark_input_json2json.write(json_data) - - subprocess.run( - ['hyperfine', '--warmup', '3', '--show-output', - '--export-json', 'benchmark_json2json.json', - '-L', 'lang', 'rust,haskell', - './test_data/benchmark/json2json_{lang}.py'], - check=True) - print() - - bench_json2json = json.load(open('benchmark_json2json.json')) - - means_json2json = { - "haskell": get_bench_mean(bench_json2json, "haskell"), - } - - json2json_rust_mean = get_bench_mean(bench_json2json, "rust") - - validate_thresholds("json2json", RATIOS_JSON2JSON, means_json2json, json2json_rust_mean) - - if FAILED[0]: - sys.exit(1) - - -if __name__ == '__main__': - main() From 48aab6144f00b5cbdc780f00c124fa7d1b2a873d Mon Sep 17 00:00:00 2001 From: adrian-kong Date: Tue, 5 Jul 2022 16:38:22 +1000 Subject: [PATCH 5/6] release alpha --- c/include/libsbp/version.h | 2 +- haskell/sbp.cabal | 2 +- javascript/sbp/RELEASE-VERSION | 2 +- python/sbp/RELEASE-VERSION | 2 +- rust/sbp/Cargo.toml | 2 +- rust/sbp2json/Cargo.toml | 2 +- test_data/benchmark_main.py | 137 +++++++++++++++++++++++++++++++++ 7 files changed, 143 insertions(+), 6 deletions(-) create mode 100755 test_data/benchmark_main.py diff --git a/c/include/libsbp/version.h b/c/include/libsbp/version.h index 1d556a0347..ed8505ccec 100644 --- a/c/include/libsbp/version.h +++ b/c/include/libsbp/version.h @@ -28,7 +28,7 @@ #define SBP_PATCH_VERSION 0 /** Full SBP version string. */ -#define SBP_VERSION "4.5.0" +#define SBP_VERSION "4.5.1-alpha" /** Is this a staging branch? */ #define SBP_STAGING 0 diff --git a/haskell/sbp.cabal b/haskell/sbp.cabal index c4fe998f0a..b86a9eb92b 100644 --- a/haskell/sbp.cabal +++ b/haskell/sbp.cabal @@ -1,5 +1,5 @@ name: sbp -version: 4.5.0 +version: 4.5.1-alpha synopsis: SwiftNav's SBP Library homepage: https://github.com/swift-nav/libsbp license: MIT diff --git a/javascript/sbp/RELEASE-VERSION b/javascript/sbp/RELEASE-VERSION index ae153944ee..9650eaa16f 100644 --- a/javascript/sbp/RELEASE-VERSION +++ b/javascript/sbp/RELEASE-VERSION @@ -1 +1 @@ -4.5.0 \ No newline at end of file +4.5.1-alpha \ No newline at end of file diff --git a/python/sbp/RELEASE-VERSION b/python/sbp/RELEASE-VERSION index ae153944ee..9650eaa16f 100644 --- a/python/sbp/RELEASE-VERSION +++ b/python/sbp/RELEASE-VERSION @@ -1 +1 @@ -4.5.0 \ No newline at end of file +4.5.1-alpha \ No newline at end of file diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml index eb44ad8e82..5fe8f4902e 100644 --- a/rust/sbp/Cargo.toml +++ b/rust/sbp/Cargo.toml @@ -7,7 +7,7 @@ [package] name = "sbp" -version = "4.5.0" +version = "4.5.1-alpha" description = "Rust native implementation of SBP (Swift Binary Protocol) for communicating with devices made by Swift Navigation" authors = ["Swift Navigation "] repository = "https://github.com/swift-nav/libsbp" diff --git a/rust/sbp2json/Cargo.toml b/rust/sbp2json/Cargo.toml index 7bb4c24036..9f5a797805 100644 --- a/rust/sbp2json/Cargo.toml +++ b/rust/sbp2json/Cargo.toml @@ -7,7 +7,7 @@ [package] name = "sbp2json" -version = "4.5.0-unreleased" +version = "4.5.1-alpha" description = "Rust native implementation of SBP (Swift Binary Protocol) to JSON conversion tools" authors = ["Swift Navigation "] edition = "2018" diff --git a/test_data/benchmark_main.py b/test_data/benchmark_main.py new file mode 100755 index 0000000000..789f1d6146 --- /dev/null +++ b/test_data/benchmark_main.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python3 + +import os +import sys +import gzip +import json +import subprocess + +# If the ratio is off from expected by more than this percentage +SLUSH_PERCENTAGE = 0.25 + +# How much faster Rust should be than other implementations +RATIOS_SBP2JSON = { + "haskell": 2.17, + "python": 21.93, +} + +RATIOS_JSON2SBP = { + "haskell": 2.05, +} + +RATIOS_JSON2JSON = { + "haskell": 2.56, +} + +FAILED = [False] + + +def maybe_via_docker(pwd, image, cmd): + if not os.environ.get('VIA_DOCKER'): + return cmd + return [ + 'docker', 'run', '-i', + '--cpus=2', '--memory=1g', + '--rm', '-v', f'{pwd}:/work', + image + ] + cmd + + +def compare_ratio(expected, actual): + diff = abs(expected - actual) + percentage = diff / expected + return percentage <= SLUSH_PERCENTAGE + + +def get_bench_mean(bench, lang): + for result in bench["results"]: + if result["parameter"] == lang: + return float(result["mean"]) + + +def validate_thresholds(binary, thresholds, means, target): + for lang in thresholds: + threshold = thresholds[lang] + ratio = means[lang] / target + if not compare_ratio(threshold, ratio): + sys.stderr.write( + f"\nERROR: {binary} speed threshold failed for {lang}, expected: {threshold}, actual: {ratio}\n\n") + sys.stderr.flush() + FAILED[0] = True + + +def main(): + + if not os.environ.get("BENCHMARK_SKIP_SBP2JSON"): + subprocess.run( + ['hyperfine', '--warmup', '5', '--min-runs', '20', + '--show-output', '--export-json', 'benchmark_sbp2json.json', + '-L', 'lang', 'rust,python,haskell', + './test_data/benchmark/sbp2json_{lang}.py'], + check=True) + print() + + bench_sbp2json = json.load(open('benchmark_sbp2json.json')) + sbp2json_rust_mean = get_bench_mean(bench_sbp2json, "rust") + means_sbp2json = { + "haskell": get_bench_mean(bench_sbp2json, "haskell"), + "python": get_bench_mean(bench_sbp2json, "python"), + } + + validate_thresholds("sbp2json", RATIOS_SBP2JSON, means_sbp2json, sbp2json_rust_mean) + + benchmark_input_json2sbp_gz = open("test_data/benchmark.json2sbp.gz", "rb") + json_data = gzip.decompress(benchmark_input_json2sbp_gz.read()) + + with open("test_data/benchmark.json2sbp", "wb") as benchmark_input_json2sbp: + benchmark_input_json2sbp.write(json_data) + + if not os.environ.get("BENCHMARK_SKIP_JSON2SBP"): + subprocess.run( + ['hyperfine', '--warmup', '3', '--show-output', + '--export-json', 'benchmark_json2sbp.json', + '-L', 'lang', 'rust,haskell', + './test_data/benchmark/json2sbp_{lang}.py'], + check=True) + print() + + bench_json2sbp = json.load(open('benchmark_json2sbp.json')) + + means_json2sbp = { + "haskell": get_bench_mean(bench_json2sbp, "haskell"), + } + + json2sbp_rust_mean = get_bench_mean(bench_json2sbp, "rust") + + validate_thresholds("json2sbp", RATIOS_JSON2SBP, means_json2sbp, json2sbp_rust_mean) + + benchmark_input_json2json_gz = open("test_data/benchmark.json2json.gz", "rb") + json_data = gzip.decompress(benchmark_input_json2json_gz.read()) + + with open("test_data/benchmark.json2json", "wb") as benchmark_input_json2json: + benchmark_input_json2json.write(json_data) + + subprocess.run( + ['hyperfine', '--warmup', '3', '--show-output', + '--export-json', 'benchmark_json2json.json', + '-L', 'lang', 'rust,haskell', + './test_data/benchmark/json2json_{lang}.py'], + check=True) + print() + + bench_json2json = json.load(open('benchmark_json2json.json')) + + means_json2json = { + "haskell": get_bench_mean(bench_json2json, "haskell"), + } + + json2json_rust_mean = get_bench_mean(bench_json2json, "rust") + + validate_thresholds("json2json", RATIOS_JSON2JSON, means_json2json, json2json_rust_mean) + + if FAILED[0]: + sys.exit(1) + + +if __name__ == '__main__': + main() From ce6351ab1653053785f6a27b683acc3e7b7c69fc Mon Sep 17 00:00:00 2001 From: adrian-kong Date: Tue, 5 Jul 2022 16:46:32 +1000 Subject: [PATCH 6/6] enforce jdk11 --- java/build.gradle | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/build.gradle b/java/build.gradle index 63099becbc..54c1da0a37 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -5,9 +5,14 @@ plugins { id "com.diffplug.gradle.spotless" version "4.5.1" id 'maven-publish' id 'signing' + id 'java' } -apply plugin: 'java' +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} repositories { mavenCentral()