Skip to content

Conversation

Zabrane
Copy link

@Zabrane Zabrane commented Aug 25, 2025

Replace verbose case expression with direct boolean assignment.

This makes the code more readable and slightly more efficient by eliminating intermediate variable and pattern matching overhead.

The behavior remains identical: prim_load=true when Mode==embedded, prim_load=false otherwise.

What changed

Refactored the kernel_load_completed clause in eval_script/2 to use direct boolean assignment instead of a case expression.

How

  • Before: 6-line case expression with intermediate variable Es
  • After: Single line with prim_load=(Mode == embedded)

Why this is better

  • Readability: The intent is immediately clear - prim_load directly reflects whether mode is embedded
  • Conciseness: Reduces code from 6 lines to 2 lines
  • Performance: Eliminates pattern matching overhead and intermediate record creation
  • Maintainability: Less code to understand and modify

Safety

Behavior remains functionally identical:

  • When Mode == embedded: prim_load = true
  • When Mode != embedded: prim_load = false

The original logic is preserved - this is purely a code quality improvement.

Replace verbose case expression with direct boolean assignment.

This makes the code more readable and slightly more efficient
by eliminating intermediate variable and pattern matching overhead.

The behavior remains identical: prim_load=true when Mode==embedded,
prim_load=false otherwise.
@CLAassistant
Copy link

CLAassistant commented Aug 25, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

github-actions bot commented Aug 25, 2025

CT Test Results

    3 files    142 suites   51m 53s ⏱️
1 649 tests 1 592 ✅ 57 💤 0 ❌
2 372 runs  2 295 ✅ 77 💤 0 ❌

Results for commit 5427a77.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Aug 25, 2025
@jhogberg jhogberg self-assigned this Aug 25, 2025
@jhogberg jhogberg added the testing currently being tested, tag is used by OTP internal CI label Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants