import bench_pms import pandas as pd from pyModeS import c_common, py_common
from rs1090 import decode
msg = "8DA05F219B06B6AF189400CBC33F"
decode(msg)
bench_pms.decode(msg, py_common)
bench_pms.decode(msg, c_common)
data = pd.read_csv(
"../../crates/rs1090/data/long_flight.csv",
names=["timestamp", "rawmsg"],
)
decoded = decode(data.rawmsg.str[18:], data.timestamp, reference=(43.3, 1.35))
decoded = decode(data.rawmsg.str[18:])
decoded = decode(data.rawmsg.str[18:], batch=data.shape[0])
decoded = [bench_pms.decode(msg, c_common) for msg in data.rawmsg.str[18:]]
decoded = [bench_pms.decode(msg, py_common) for msg in data.rawmsg.str[18:]]
n = data.shape[0]
result = pd.DataFrame.from_records(
[
{"type": "rs1090 (Rust, default)", "time": 0.755, "std": 0.015},
{"type": "rs1090 (Python, default)", "time": 1.46, "std": 0.03},
{"type": "rs1090 (Python, single core)", "time": 4.15, "std": 0.093},
{"type": "pyModeS (compiled)", "time": 9.27, "std": 0.154},
{"type": "pyModeS (Python)", "time": 16, "std": 0.183},
]
)
import altair as alt
chart = (
alt.Chart(result)
.mark_bar()
.encode(
alt.X(
"time",
axis=alt.Axis(format="~s"),
title="Decoding time (in μs per message)",
),
alt.Y("type", title=None, sort="-x"),
alt.Color("type", legend=None), )
.transform_calculate(time=f"datum.time / {n}")
.properties(width=500, height=100)
.configure_axis(
labelFont="Noto Sans",
titleFont="Noto Sans",
labelFontSize=13,
titleFontSize=15,
titleAnchor="end",
)
)
chart.save("benchmark.svg")
chart