Skip to content

Optimize pattern matching on constants #1185

@ospencer

Description

@ospencer

When matching on constants, we essentially compile something like match (...) { 'a' => ..., 'b' => ..., ... } into an if chain of if (val == 'a') { goto branch 1 } else if (val == 'b') { goto branch 2 } else .... We can instead compile them as though they were variants, and just do a br_table.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions