Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(planning_debug_tools): improve calculation time of perception_reproducer #5894

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,14 @@

# copy the messages
self.stopwatch.tic("message deepcopy")
msgs = pickle.loads(pickle.dumps(msgs_orig)) # this is x5 faster than deepcopy
objects_msg = msgs[0]
traffic_signals_msg = msgs[1]
if self.args.detected_object:
msgs = pickle.loads(pickle.dumps(msgs_orig)) # this is x5 faster than deepcopy
objects_msg = msgs[0]
traffic_signals_msg = msgs[1]
else:
# NOTE: No need to deepcopy since only timestamp will be changed and it will be changed every time correctly.
objects_msg = msgs_orig[0]
traffic_signals_msg = msgs_orig[1]

Check warning on line 94 in planning/planning_debug_tools/scripts/perception_replayer/perception_reproducer.py

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

PerceptionReproducer.on_timer increases in cyclomatic complexity from 12 to 14, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
self.stopwatch.toc("message deepcopy")

self.stopwatch.tic("transform and publish")
Expand Down
Loading