Skip to content

Analyze code slowdown issues after upstream sync - Duration parameter ambiguity in continue_simple_runner()#29

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/analyze-code-slowdown-issues
Draft

Analyze code slowdown issues after upstream sync - Duration parameter ambiguity in continue_simple_runner()#29
Copilot wants to merge 5 commits intomainfrom
copilot/analyze-code-slowdown-issues

Conversation

Copy link

Copilot AI commented Oct 10, 2025

Overview

This PR provides a comprehensive analysis of potential code slowdown issues in examples/A3_modified.py after syncing with upstream (ci-group/ariel). The analysis identifies the root cause and provides detailed documentation with recommendations for fixing the issue.

Problem Identified

The upstream sync introduced a new continue_simple_runner() function in src/ariel/utils/runners.py that has an ambiguous duration parameter. The function interprets duration as an absolute simulation time rather than an incremental duration, leading to significantly shorter simulation times than potentially intended.

The Issue

With the current configuration:

duration_flat: int = 15
duration_rugged: int = 30
duration_elevated: int = 55

Current behavior (absolute time interpretation):

  • Flat terrain: 0 → 15s (15 seconds)
  • Rugged terrain: 15 → 30s (15 seconds added)
  • Elevated terrain: 30 → 55s (25 seconds added)
  • Total: 55 seconds

Possible original intent (incremental duration):

  • Flat terrain: 0 → 15s (15 seconds)
  • Rugged terrain: 15 → 45s (30 seconds added)
  • Elevated terrain: 45 → 100s (55 seconds added)
  • Total: 100 seconds

Impact: 45 seconds difference (82% shorter with current behavior)

Why This Causes "Slowdown"

If simulations run for 55 seconds instead of the expected 100 seconds:

  • ❌ Robots have less time to demonstrate locomotion capabilities
  • ❌ Robots travel shorter distances toward targets
  • ❌ Fitness scores are lower than expected
  • ❌ Different selection pressure in the evolutionary algorithm
  • ❌ Fewer robots pass checkpoints to unlock extended terrains
  • ❌ EA appears to make slower progress or stagnate

Analysis Deliverables

This PR includes comprehensive documentation to help understand and resolve the issue:

1. ANALYSIS_SUMMARY.md (5.1 KB)

Executive summary with clear explanation of the issue, impact, and recommended fix. Start here for quick overview.

2. README_ANALYSIS.md (5.9 KB)

Master index describing all analysis files, providing a roadmap through the documentation.

3. QUICKSTART_ANALYSIS.md (4.6 KB)

User-friendly guide with:

  • Comparison table showing 55s vs 100s behavior
  • Three fix options with code examples
  • Quick verification steps

4. SLOWDOWN_ANALYSIS.md (6.0 KB)

Complete technical deep dive including:

  • Detailed code comparisons
  • Analysis of all potential performance issues
  • Multiple solution approaches with trade-offs
  • Testing recommendations

5. TIMELINE_VISUALIZATION.txt (6.5 KB)

ASCII timeline visualization clearly showing the difference between absolute and incremental time interpretations.

6. test_duration_semantics.py (5.1 KB)

Executable demonstration script that shows exactly how the two interpretations differ:

python test_duration_semantics.py
# Output shows 55s vs 100s comparison

Recommended Fix

File: src/ariel/utils/runners.py (lines 64-65)

Current code:

def continue_simple_runner(model, data, duration=10.0, steps_per_loop=100):
    while data.time < duration:
        mujoco.mj_step(model, data, nstep=steps_per_loop)

Recommended change:

def continue_simple_runner(model, data, duration=10.0, steps_per_loop=100):
    end_time = data.time + duration  # Make duration incremental
    while data.time < end_time:
        mujoco.mj_step(model, data, nstep=steps_per_loop)

This 2-line change makes the duration parameter incremental instead of absolute, restoring the expected 100-second total simulation time.

Verification

To verify which interpretation is correct:

  1. Run the demonstration:

    python test_duration_semantics.py
  2. Check actual behavior:

    • Are robots reaching checkpoints as expected?
    • What are typical fitness value ranges?
    • How long should simulations actually run?
  3. Compare results:

    • Review checkpoint pass rates
    • Check if EA progress matches expectations

Notes

  • This PR contains analysis and documentation only - no code changes to the actual implementation
  • The recommended fix should be applied in a separate PR after determining the intended behavior
  • All analysis files are in the repository root for easy access
  • The issue stems from an ambiguous API design where duration could mean either "target time" or "additional duration"

Related

  • Upstream sync commit: b465e55 ("Merge remote-tracking branch 'upstream/main'")
  • Affected file: examples/A3_modified.py
  • Root cause: New continue_simple_runner() function in src/ariel/utils/runners.py
Original prompt

Look at the differences before and after I synced with upstream (ci-group), and tell me what possible reasons for code slowdown there could be for my examples/A3_modified.py


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 4 commits October 10, 2025 08:05
Co-authored-by: coopa33 <120227355+coopa33@users.noreply.github.com>
Co-authored-by: coopa33 <120227355+coopa33@users.noreply.github.com>
Co-authored-by: coopa33 <120227355+coopa33@users.noreply.github.com>
Co-authored-by: coopa33 <120227355+coopa33@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate code slowdown in examples/A3_modified.py Analyze code slowdown issues after upstream sync - Duration parameter ambiguity in continue_simple_runner() Oct 10, 2025
Copilot AI requested a review from coopa33 October 10, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants