Skip to content

Refactor and optimize Sidelink MAC scheduling code for better performance,...

Shrinish Donde requested to merge shrinish/openairinterface5g:develop into develop

Refactor and optimize Sidelink MAC scheduling code for better performance, readability, and maintainability

  • Optimized sl_get_elapsed_slots by using __builtin_popcount to improve bitwise operation performance, reducing the need for manual bit-checking loops.
  • Replaced magic numbers with descriptive constants (SLOTS_PER_FRAME_10_MS, NR_FRAME_CYCLE_1024) to improve readability and maintainability.
  • Added memory management to sl_determine_slot_bitmap by freeing previously allocated memory for future_ttis to avoid potential memory leaks.
  • Modularized complex functions by refactoring large functions like nr_ue_sidelink_scheduler into smaller, purpose-driven functions (schedule_psbch, adjust_ssb_timing, update_indices_post_timing).
  • Improved logging by using conditional debug logging for non-critical information, reducing excessive verbosity in real-time systems.
  • Applied const to function parameters that should remain immutable, enhancing safety and clarity of the code.
  • Added clarifying comments to explain the logic behind key sections of the code for better understanding and future maintenance.

Merge request reports