Skip to content

Introduce optimization options #44

Open

Description

@CookiePLMonster

SCM has plenty of low hanging fruit with optimizations which can substantially reduce code size, which might be useful for some bigger projects.

Two optimizations are very simplistic and should be easy to implement:

  • Skipping if 0 statements from high level constructs. When using manual jumps/else_jumps the user might save space by not including an if statement for single conditions, but for high level constructs it's not possible.
  • Replacing 0.0f with 0 - with former being 4 bytes and latter being 1 byte, script processor evaluates them to identical values. Safe even for comparison commands, as reinterpreting integer 0 as float 0.0 is okay.

More complex optimizations? Would be welcome, but they aren't nearly as trivial:

  • Simplifying labels - with high level constructs it's very common to see else_jump -> jump -> jump.... In theory they could be optimized and maybe it'd result in size and performance optimizations.

As far as those go, the two simple optimizations are kind of "must have", label analysis is a welcome extra but I am aware that it might be more complex than it sounds, so I wouldn't consider it high priority.

Activity

  1. added
    priority:p2
    type:feature
    on Aug 6, 2020
  2. x87 commented on Sep 23, 2020

    @x87
    Collaborator

    Also dropping defined objects list saves 24 bytes per each unused object.

  3. removed
    priority:p2
    on Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope:compilertype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions