ros2 / ros2/launch

_prune_and_count iterating over collection twice

Open
#309 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
155
Forks
182
Avg merge
2d 14h
Merged PRs (30d)
6

Description

In launch_service.py, the methods LaunchService._prune_and_count_entity_future_pairs() and LaunchService._prune_and_count_context_completion_futures() perform an unneeded scan through their respective containers just to decide if another scan (using the exact same check) is needed to prune their respective containers (LaunchService._entity_future_pairs and LaunchService.__context.._completion_futures)

I am not sure if this would cause any issues with the launch process, but it looks a bit odd. If there are a lot of elements in either of the collections, it could conceivably be the cause of a slowdown.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in launch_service.py with LaunchService._prune_and_count_entity_future_pairs() and LaunchService._prune_and_count_context_completion_futures(), then inspect _entity_future_pairs and __context.._completion_futures. Compare the repeated checks and confirm that pruning behavior remains unchanged while the unnecessary scan is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.