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

Introduce optimization options #44

Open
CookiePLMonster opened this issue Aug 6, 2020 · 1 comment
Open

Introduce optimization options #44

CookiePLMonster opened this issue Aug 6, 2020 · 1 comment
Labels
priority:p2 Medium priority scope:compiler type:feature New feature or request

Comments

@CookiePLMonster
Copy link

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.

@x87
Copy link
Collaborator

x87 commented Sep 23, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p2 Medium priority scope:compiler type:feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants