Skip to content

expr: optimization for integer values #5591

@tertsdiepraam

Description

@tertsdiepraam

Currently, expr uses only string values internally. This means that for an expression like 1 + 2 + 9 is evaluated as follows:

  1. Get the strings "1" and "2"
  2. Parse them into integers 1 and 2
  3. Add them to get 3
  4. Turn 3 into the string "3"
  5. Parse "3" back into the integer 3
  6. Parse "9" into 9
  7. Add them to get 12
  8. Turn 12 into the string "12"

That's a lot of parsing and stringifying. Instead we could have an enum that can contain either an integer or a string which can be turned into the desired value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions