@@ -17,7 +17,6 @@ limitations under the License.
1717use std:: time:: Duration ;
1818
1919use criterion:: { criterion_group, criterion_main, Criterion } ;
20- use hyperlight_common:: flatbuffer_wrappers:: function_types:: { ParameterValue , ReturnType } ;
2120use hyperlight_host:: sandbox:: { MultiUseSandbox , SandboxConfiguration , UninitializedSandbox } ;
2221use hyperlight_host:: sandbox_state:: sandbox:: EvolvableSandbox ;
2322use hyperlight_host:: sandbox_state:: transition:: Noop ;
@@ -41,15 +40,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
4140 group. bench_function ( "guest_call" , |b| {
4241 let mut call_ctx = create_multiuse_sandbox ( ) . new_call_context ( ) ;
4342
44- b. iter ( || {
45- call_ctx
46- . call (
47- "Echo" ,
48- ReturnType :: Int ,
49- Some ( vec ! [ ParameterValue :: String ( "hello\n " . to_string( ) ) ] ) ,
50- )
51- . unwrap ( )
52- } ) ;
43+ b. iter ( || call_ctx. call :: < i32 > ( "Echo" , "hello\n " . to_string ( ) ) . unwrap ( ) ) ;
5344 } ) ;
5445
5546 // Benchmarks a single guest function call.
@@ -59,11 +50,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
5950
6051 b. iter ( || {
6152 sandbox
62- . call_guest_function_by_name (
63- "Echo" ,
64- ReturnType :: Int ,
65- Some ( vec ! [ ParameterValue :: String ( "hello\n " . to_string( ) ) ] ) ,
66- )
53+ . call_guest_function_by_name :: < i32 > ( "Echo" , "hello\n " . to_string ( ) )
6754 . unwrap ( )
6855 } ) ;
6956 } ) ;
@@ -89,13 +76,9 @@ fn guest_call_benchmark(c: &mut Criterion) {
8976
9077 b. iter ( || {
9178 sandbox
92- . call_guest_function_by_name (
79+ . call_guest_function_by_name :: < ( ) > (
9380 "LargeParameters" ,
94- ReturnType :: Void ,
95- Some ( vec ! [
96- ParameterValue :: VecBytes ( large_vec. clone( ) ) ,
97- ParameterValue :: String ( large_string. clone( ) ) ,
98- ] ) ,
81+ ( large_vec. clone ( ) , large_string. clone ( ) ) ,
9982 )
10083 . unwrap ( )
10184 } ) ;
@@ -115,15 +98,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
11598 uninitialized_sandbox. evolve ( Noop :: default ( ) ) . unwrap ( ) ;
11699 let mut call_ctx = multiuse_sandbox. new_call_context ( ) ;
117100
118- b. iter ( || {
119- call_ctx
120- . call (
121- "Add" ,
122- ReturnType :: Int ,
123- Some ( vec ! [ ParameterValue :: Int ( 1 ) , ParameterValue :: Int ( 41 ) ] ) ,
124- )
125- . unwrap ( )
126- } ) ;
101+ b. iter ( || call_ctx. call :: < i32 > ( "Add" , ( 1_i32 , 41_i32 ) ) . unwrap ( ) ) ;
127102 } ) ;
128103
129104 group. finish ( ) ;
0 commit comments