debug/check_can_parser_performance: remove overhead of capnp conversion (#32048)

pull/32055/head
Dean Lee 1 year ago committed by GitHub
parent 6f223fc1c1
commit 178cc8747c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      selfdrive/debug/check_can_parser_performance.py

@ -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')

Loading…
Cancel
Save