Skip to content

feat(performance): Always inline certain small methods#13

Merged
TomAFrench merged 2 commits intomainfrom
mv/inline-always-on-some-methods
Feb 13, 2025
Merged

feat(performance): Always inline certain small methods#13
TomAFrench merged 2 commits intomainfrom
mv/inline-always-on-some-methods

Conversation

@vezenovm
Copy link
Contributor

@vezenovm vezenovm commented Feb 13, 2025

Description

Problem*

Part of general effort to reduce Brillig bytecode sizes and execution trace

Summary*

Certain small methods like lshift8 are called repeatedly but in fact do very little:
These are the internals of lshift8 in an unconstrained context.

if is_unconstrained() {
        if item == 0 {
            0
        } else {
            // Brillig wouldn't shift 0<<4 without overflow.
            item << (8 * shifts)
        }
    }

We can avoid the function call overhead for this method that is itself only a few instructions and is likely to be simplified further as shifts is often a constant.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@TomAFrench TomAFrench merged commit 96c43cc into main Feb 13, 2025
10 checks passed
@github-actions github-actions bot mentioned this pull request Feb 13, 2025
@vezenovm vezenovm mentioned this pull request May 1, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants