File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,24 @@ fn table_traversal_for_each(c: &mut Criterion) {
112
112
} ) ;
113
113
}
114
114
115
+ fn table_traversal_sequence ( c : & mut Criterion ) {
116
+ let lua = Lua :: new ( ) ;
117
+
118
+ let table = lua. create_sequence_from ( 1 ..1000 ) . unwrap ( ) ;
119
+
120
+ c. bench_function ( "table traversal [sequence]" , |b| {
121
+ b. iter_batched (
122
+ || table. clone ( ) ,
123
+ |table| {
124
+ for v in table. sequence_values :: < i32 > ( ) {
125
+ let _i = v. unwrap ( ) ;
126
+ }
127
+ table_traversal_sequence} ,
128
+ BatchSize :: SmallInput ,
129
+ ) ;
130
+ } ) ;
131
+ }
132
+
115
133
fn create_function ( c : & mut Criterion ) {
116
134
let lua = Lua :: new ( ) ;
117
135
@@ -361,6 +379,7 @@ criterion_group! {
361
379
table_get_set,
362
380
table_traversal_pairs,
363
381
table_traversal_for_each,
382
+ table_traversal_sequence,
364
383
create_function,
365
384
call_lua_function,
366
385
call_sum_callback,
You can’t perform that action at this time.
0 commit comments