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

bigint literal is terribly inefficient #926

Open
bobzhang opened this issue Aug 27, 2024 · 2 comments
Open

bigint literal is terribly inefficient #926

bobzhang opened this issue Aug 27, 2024 · 2 comments
Assignees

Comments

@bobzhang
Copy link
Contributor

fn testgxx () -> Unit {
    let v = 0N
    match v {
        1 => println("hello")
    }
    println(v)
}

==>

fn testgxx () -> Unit {
  let v/1 : BigInt = BigInt::from_string("0") in
  if BigInt::op_equal(v/1, BigInt::from_string("1")) {
    $builtin.println("hello")
  } else {
    raise "match_failure"
  }
  $builtin.println(v/1)
}
@bobzhang
Copy link
Contributor Author

bobzhang commented Aug 29, 2024

for pattern match:
we can provide two functions, so that no allocation is needed in most cases:

equal_int(BigInt, Int) -> Bool
equal_int64(BigInt, Int64) -> Bool

cc @Yoorkin @peter-jerry-ye

@bobzhang
Copy link
Contributor Author

#937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants