@@ -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 } ) ;
@@ -88,13 +75,9 @@ fn guest_call_benchmark(c: &mut Criterion) {
8875
8976 b. iter ( || {
9077 sandbox
91- . call_guest_function_by_name (
78+ . call_guest_function_by_name :: < ( ) > (
9279 "LargeParameters" ,
93- ReturnType :: Void ,
94- Some ( vec ! [
95- ParameterValue :: VecBytes ( large_vec. clone( ) ) ,
96- ParameterValue :: String ( large_string. clone( ) ) ,
97- ] ) ,
80+ ( large_vec. clone ( ) , large_string. clone ( ) ) ,
9881 )
9982 . unwrap ( )
10083 } ) ;
@@ -114,15 +97,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
11497 uninitialized_sandbox. evolve ( Noop :: default ( ) ) . unwrap ( ) ;
11598 let mut call_ctx = multiuse_sandbox. new_call_context ( ) ;
11699
117- b. iter ( || {
118- call_ctx
119- . call (
120- "Add" ,
121- ReturnType :: Int ,
122- Some ( vec ! [ ParameterValue :: Int ( 1 ) , ParameterValue :: Int ( 41 ) ] ) ,
123- )
124- . unwrap ( )
125- } ) ;
100+ b. iter ( || call_ctx. call :: < i32 > ( "Add" , ( 1_i32 , 41_i32 ) ) . unwrap ( ) ) ;
126101 } ) ;
127102
128103 group. finish ( ) ;
0 commit comments