mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-28 18:33:45 +08:00
debug/check_can_parser_performance: remove overhead of capnp conversion (#32048)
old-commit-hash: 178cc8747c5b365490abaa0fc594e009309c661f
This commit is contained in:
@@ -25,11 +25,12 @@ if __name__ == '__main__':
|
||||
CC = car.CarControl.new_message()
|
||||
ets = []
|
||||
for _ in tqdm(range(N_RUNS)):
|
||||
msgs = [(m.as_builder().to_bytes(),) for m in tm.can_msgs]
|
||||
start_t = time.process_time_ns()
|
||||
for msg in tm.can_msgs:
|
||||
for msg in msgs:
|
||||
for cp in tm.CI.can_parsers:
|
||||
if cp is not None:
|
||||
cp.update_strings((msg.as_builder().to_bytes(),))
|
||||
cp.update_strings(msg)
|
||||
ets.append((time.process_time_ns() - start_t) * 1e-6)
|
||||
|
||||
print(f'{len(tm.can_msgs)} CAN packets, {N_RUNS} runs')
|
||||
|
||||
Reference in New Issue
Block a user