cairo-lang-runner 2.19.2

Basic cairo runner.
Documentation
//! > Test profiling info of enum_flow.sierra

//! > test_runner_name
test_profiling

//! > cairo_code
>>> file: ../../examples/enum_flow.cairo

//! > function_name
main

//! > expected_profiling_info
Weight by sierra statement:
  statement 1: 1 (store_temp<felt252>([0]) -> ([0]))
  statement 2: 1 (return([0]))
Weight by concrete libfunc:
  libfunc store_temp<felt252>: 1
  return: 1
Weight by generic libfunc:
  libfunc store_temp: 1
  return: 1
Weight by user function (inc. generated):
  function test::main: 2
Weight by original user function (exc. generated):
  function test::main: 2
Weight by Cairo function:
  function lib.cairo::main: 2
Weight by Sierra stack trace:
  test::main: 2
Weight by Cairo stack trace:
  test::main: 2

//! > ==========================================================================

//! > Test profiling info of match_or.sierra

//! > test_runner_name
test_profiling

//! > cairo_code
>>> file: ../../examples/match_or.cairo

//! > function_name
main

//! > expected_profiling_info
Weight by sierra statement:
  statement 3: 3 (store_temp<core::panics::PanicResult::<((),)>>([2]) -> ([2]))
  statement 4: 1 (return([2]))
Weight by concrete libfunc:
  libfunc store_temp<core::panics::PanicResult::<((),)>>: 3
  return: 1
Weight by generic libfunc:
  libfunc store_temp: 3
  return: 1
Weight by user function (inc. generated):
  function test::main: 4
Weight by original user function (exc. generated):
  function test::main: 4
Weight by Cairo function:
  function lib.cairo::main: 4
Weight by Sierra stack trace:
  test::main: 4
Weight by Cairo stack trace:
  test::main: 4

//! > ==========================================================================

//! > Test profiling info of pedersen_test.sierra

//! > test_runner_name
test_profiling

//! > cairo_code
>>> file: ../../examples/pedersen_test.cairo

//! > function_name
test_pedersen

//! > expected_profiling_info
Weight by sierra statement:
  statement 4: 2 (pedersen([0], [1], [2]) -> ([3], [4]))
  statement 8: 2 (pedersen([3], [4], [5]) -> ([6], [7]))
  statement 12: 2 (pedersen([6], [7], [8]) -> ([9], [10]))
  statement 2: 1 (store_temp<felt252>([1]) -> ([1]))
  statement 3: 1 (store_temp<felt252>([2]) -> ([2]))
  statement 6: 1 (store_temp<felt252>([4]) -> ([4]))
  statement 7: 1 (store_temp<felt252>([5]) -> ([5]))
  statement 10: 1 (store_temp<felt252>([7]) -> ([7]))
  statement 11: 1 (store_temp<felt252>([8]) -> ([8]))
  statement 13: 1 (store_temp<Pedersen>([9]) -> ([9]))
  statement 14: 1 (store_temp<felt252>([10]) -> ([10]))
  statement 15: 1 (return([9], [10]))
Weight by concrete libfunc:
  libfunc store_temp<felt252>: 7
  libfunc pedersen: 6
  libfunc store_temp<Pedersen>: 1
  return: 1
Weight by generic libfunc:
  libfunc store_temp: 8
  libfunc pedersen: 6
  return: 1
Weight by user function (inc. generated):
  function test::test_pedersen: 15
Weight by original user function (exc. generated):
  function test::test_pedersen: 15
Weight by Cairo function:
  function lib.cairo::test_pedersen: 15
Weight by Sierra stack trace:
  test::test_pedersen: 15
Weight by Cairo stack trace:
  test::test_pedersen: 15

//! > ==========================================================================

//! > Test profiling info of a program with a simple loop

//! > test_runner_name
test_profiling

//! > cairo_code
fn main() {
    let mut n = 5;
    loop {
        if n == 0 {
            break;
        }
        n -= 1;
    }
}

//! > function_name
main

//! > expected_profiling_info
Weight by sierra statement:
  statement 39: 15 (withdraw_gas([0], [1]) { fallthrough([3], [4]) 62([5], [6]) })
  statement 42: 5 (felt252_is_zero([7]) { fallthrough() 52([8]) })
  statement 57: 4 (store_temp<RangeCheck>([3]) -> ([3]))
  statement 58: 4 (store_temp<GasBuiltin>([13]) -> ([13]))
  statement 59: 4 (store_temp<felt252>([15]) -> ([15]))
  statement 60: 4 (function_call<user@test::main[31-113]>([3], [13], [15]) -> ([16], [17], [18]))
  statement 61: 4 (return([16], [17], [18]))
  statement 13: 3 (store_temp<core::panics::PanicResult::<((),)>>([11]) -> ([11]))
  statement 22: 3 (withdraw_gas([0], [1]) { fallthrough([2], [3]) 31([4], [5]) })
  statement 50: 3 (store_temp<core::panics::PanicResult::<(core::felt252, ())>>([12]) -> ([12]))
  statement 1: 1 (store_temp<RangeCheck>([0]) -> ([0]))
  statement 2: 1 (store_temp<GasBuiltin>([1]) -> ([1]))
  statement 3: 1 (function_call<user@test::main[31-113]{5, }>([0], [1]) -> ([2], [3], [4]))
  statement 4: 1 (enum_match<core::panics::PanicResult::<(core::felt252, ())>>([4]) { fallthrough([5]) 15([6]) })
  statement 11: 1 (store_temp<RangeCheck>([2]) -> ([2]))
  statement 12: 1 (store_temp<GasBuiltin>([7]) -> ([7]))
  statement 14: 1 (return([2], [7], [11]))
  statement 26: 1 (store_temp<RangeCheck>([2]) -> ([2]))
  statement 27: 1 (store_temp<GasBuiltin>([6]) -> ([6]))
  statement 28: 1 (store_temp<felt252>([7]) -> ([7]))
  statement 29: 1 (function_call<user@test::main[31-113]>([2], [6], [7]) -> ([8], [9], [10]))
  statement 30: 1 (return([8], [9], [10]))
  statement 48: 1 (store_temp<RangeCheck>([3]) -> ([3]))
  statement 49: 1 (store_temp<GasBuiltin>([9]) -> ([9]))
  statement 51: 1 (return([3], [9], [12]))
Weight by concrete libfunc:
  libfunc withdraw_gas: 18
  libfunc store_temp<GasBuiltin>: 8
  libfunc store_temp<RangeCheck>: 8
  libfunc felt252_is_zero: 5
  libfunc function_call<user@test::main[31-113]>: 5
  libfunc store_temp<felt252>: 5
  libfunc store_temp<core::panics::PanicResult::<((),)>>: 3
  libfunc store_temp<core::panics::PanicResult::<(core::felt252, ())>>: 3
  libfunc enum_match<core::panics::PanicResult::<(core::felt252, ())>>: 1
  libfunc function_call<user@test::main[31-113]{5, }>: 1
  return: 7
Weight by generic libfunc:
  libfunc store_temp: 27
  libfunc withdraw_gas: 18
  libfunc function_call: 6
  libfunc felt252_is_zero: 5
  libfunc enum_match: 1
  return: 7
Weight by user function (inc. generated):
  function test::main[31-113]: 46
  function test::main: 10
  function test::main[31-113]{5, }: 8
Weight by original user function (exc. generated):
  function test::main: 56
  function test::main[31-113]{5, }: 8
Weight by Cairo function:
  function lib.cairo::main: 59
  function core::Felt252PartialEq::eq: 5
Weight by Sierra stack trace:
  test::main: 64
  test::main -> test::main[31-113]{5, }: 54
  test::main -> test::main[31-113]{5, } -> test::main[31-113]: 46
  test::main -> test::main[31-113]{5, } -> test::main[31-113] -> test::main[31-113]: 37
  test::main -> test::main[31-113]{5, } -> test::main[31-113] -> test::main[31-113] -> test::main[31-113]: 28
  test::main -> test::main[31-113]{5, } -> test::main[31-113] -> test::main[31-113] -> test::main[31-113] -> test::main[31-113]: 19
  test::main -> test::main[31-113]{5, } -> test::main[31-113] -> test::main[31-113] -> test::main[31-113] -> test::main[31-113] -> test::main[31-113]: 10
Weight by Cairo stack trace:
  test::main: 64

//! > ==========================================================================

//! > Test max stack trace depth.

//! > test_runner_name
test_profiling

//! > cairo_code
fn main() {
    foo1();
}
fn foo1() {
    foo2();
    foo2();
}
fn foo2() {
    foo3();
}
fn foo3() {}

//! > max_stack_trace_depth
2

//! > function_name
main

//! > expected_profiling_info
Weight by sierra statement:
  statement 0: 1 (return())
Weight by concrete libfunc:
  return: 1
Weight by generic libfunc:
  return: 1
Weight by user function (inc. generated):
  function test::main: 1
Weight by original user function (exc. generated):
  function test::main: 1
Weight by Cairo function:
  function unknown: 1
Weight by Sierra stack trace:
  test::main: 1
Weight by Cairo stack trace:
  test::main: 1

//! > ==========================================================================

//! > Test max stack trace depth.2

//! > test_runner_name
test_profiling

//! > cairo_code
fn main() {
    foo1();
}
fn foo1() {
    foo2();
    foo2();
}
fn foo2() {
    foo3();
}
fn foo3() {}

//! > function_name
main

//! > expected_profiling_info
Weight by sierra statement:
  statement 0: 1 (return())
Weight by concrete libfunc:
  return: 1
Weight by generic libfunc:
  return: 1
Weight by user function (inc. generated):
  function test::main: 1
Weight by original user function (exc. generated):
  function test::main: 1
Weight by Cairo function:
  function unknown: 1
Weight by Sierra stack trace:
  test::main: 1
Weight by Cairo stack trace:
  test::main: 1

//! > ==========================================================================

//! > Test profiling with inlining.

//! > test_runner_name
test_profiling

//! > cairo_code
fn main() {
    foo1();
}
fn foo1() {
    foo2();
}
#[inline(always)]
fn foo2() {
    foo3();
}
fn foo3() {}

//! > function_name
main

//! > expected_profiling_info
Weight by sierra statement:
  statement 0: 1 (return())
Weight by concrete libfunc:
  return: 1
Weight by generic libfunc:
  return: 1
Weight by user function (inc. generated):
  function test::main: 1
Weight by original user function (exc. generated):
  function test::main: 1
Weight by Cairo function:
  function unknown: 1
Weight by Sierra stack trace:
  test::main: 1
Weight by Cairo stack trace:
  test::main: 1