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

[TM] Revert milla optimizations #1744

Conversation

m-dzianishchyts
Copy link
Collaborator

@m-dzianishchyts m-dzianishchyts commented Jan 12, 2025

Что этот PR делает

Откатывает недавние изменения в атмосе после #1739. Тест производительности.

Summary by Sourcery

Enhancements:

  • Simplified the air subsystem by removing the asynchronous handling of MILLA updates.

@m-dzianishchyts m-dzianishchyts added 📜 CL не требуется Эти изменения не влияют на игровой процесс или игроки по какой-то причине не должны о них знать Do Not Merge Не заливать. В ожидании хэда/хоста. Или просто временный тестмерж. Testmerge Required labels Jan 12, 2025
Copy link

sourcery-ai bot commented Jan 12, 2025

Reviewer's Guide by Sourcery

This PR reverts the MILLA optimizations introduced in #1739. It changes how the atmospherics subsystem handles MILLA synchronization and removes the concept of "sleepable" callbacks.

Sequence diagram for MILLA synchronization

sequenceDiagram
    participant SSair as SSair Subsystem
    participant MILLA as MILLA Thread
    participant Callbacks as Waiting Callbacks

    SSair->>MILLA: spawn_milla_tick_thread()
    Note over SSair: is_synchronous = FALSE
    MILLA-->>SSair: Process atmospheric simulation
    MILLA->>SSair: on_milla_tick_finished()
    Note over SSair: is_synchronous = TRUE
    activate SSair
    SSair->>Callbacks: Execute waiting callbacks
    deactivate SSair
Loading

Class diagram showing removed sleepable callback system

classDiagram
    class SSair {
        -bool is_synchronous
        -bool in_milla_safe_code
        -list waiting_for_sync
        +fire()
        +synchronize()
        +on_milla_tick_finished()
    }

    class milla_safe {
        +invoke_async()
        +on_run()
        -private_unsafe_invoke()
    }

    SSair -- milla_safe: manages
Loading

State diagram for MILLA synchronization changes

stateDiagram-v2
    [*] --> Synchronous: Initial State
    Synchronous --> Asynchronous: spawn_milla_tick_thread()
    Asynchronous --> Synchronous: on_milla_tick_finished()

    state Synchronous {
        [*] --> Safe: in_milla_safe_code = TRUE
        Safe --> [*]: in_milla_safe_code = FALSE
    }

    state Asynchronous {
        [*] --> WaitingForSync
        WaitingForSync --> ProcessCallbacks: on_milla_tick_finished()
        ProcessCallbacks --> [*]
    }
Loading

File-Level Changes

Change Details Files
Removed the concept of sleepable callbacks and simplified MILLA synchronization.
  • Removed sleepers and sleepable_waiting_for_sync lists.
  • Removed has_sleeper proc.
  • Renamed milla_idle to is_synchronous.
  • Simplified fire proc to only wait for is_synchronous.
  • Removed run_sleeping_callbacks proc.
  • Simplified on_milla_tick_finished proc.
  • Removed sleepable_synchronize proc.
  • Removed milla_safe_must_sleep datum and related procs.
  • Replaced milla_safe_must_sleep with milla_safe datum in affected files.
  • Updated late_setup_level datum to no longer accept turf arguments and use the new setup_allturfs_sleepless proc.
  • Updated docking_port_dock datum to use milla_safe.
  • Updated ventcrawl_test_setup datum to use milla_safe.
  • Updated map template loading to use milla_safe.
code/controllers/subsystem/SSair.dm
code/modules/awaymissions/zlevel_helpers.dm
code/modules/shuttle/shuttle.dm
code/tests/atmos/test_ventcrawl.dm
code/datums/helper_datums/map_template.dm
Changed how turf atmospherics are initialized.
  • Removed setup_turfs proc and replaced it with setup_allturfs and setup_allturfs_sleepless. These procs now directly initialize the turf atmospherics instead of calling milla_load_turfs.
  • Removed milla_load_turfs from Rust and DM.
  • Removed private_unsafe_recalculate_atmos_connectivity proc and replaced it with recalculate_atmos_connectivity, which uses a milla_safe callback.
  • Removed milla_atmos_airtight, milla_superconductivity, and milla_data variables from the turf datum.
  • Added Initialize_Atmos proc to the turf datum to initialize atmospherics data.
  • Updated gateway_initialize.dm to use the new setup_allturfs_sleepless proc.
code/controllers/subsystem/SSair.dm
code/modules/atmospherics/environmental/LINDA_turf_tile.dm
rust/src/milla/api.rs
code/game/turfs/turf.dm
code/__DEFINES/rust.dm
modular_ss220/gateway/code/gateway_initialize.dm

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added :feelsgood: Частичная модульность Не всегда получается всё впихнуть в модуль, увы. 🎸 Инструменты Мы выдаем себя за реальное сообщество разработчиков. labels Jan 12, 2025
@m-dzianishchyts
Copy link
Collaborator Author

!build_rust

@m-dzianishchyts m-dzianishchyts force-pushed the revert-milla-optimizations branch 2 times, most recently from d903f25 to 0f782bf Compare January 12, 2025 17:57
@m-dzianishchyts m-dzianishchyts force-pushed the revert-milla-optimizations branch from 0f782bf to d2de917 Compare January 12, 2025 18:02
@m-dzianishchyts m-dzianishchyts changed the title Revert milla optimizations [TM] Revert milla optimizations Jan 12, 2025
@github-actions github-actions bot added the Merge Conflict Ну блять... label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge Не заливать. В ожидании хэда/хоста. Или просто временный тестмерж. :feelsgood: Частичная модульность Не всегда получается всё впихнуть в модуль, увы. 🎸 Инструменты Мы выдаем себя за реальное сообщество разработчиков. Merge Conflict Ну блять... 📜 CL не требуется Эти изменения не влияют на игровой процесс или игроки по какой-то причине не должны о них знать Testmerge Required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant