File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- use bibdata_rs:: marc:: { call_number:: call_number_labels_for_display, genre:: genres} ;
1+ use bibdata_rs:: {
2+ marc:: { call_number:: call_number_labels_for_display, genre:: genres} ,
3+ solr:: AuthorRoles ,
4+ } ;
25use criterion:: { Criterion , criterion_group, criterion_main} ;
36use marctk:: Record ;
47
8+ fn author_role_benchmark ( c : & mut Criterion ) {
9+ let record = Record :: from_xml_file ( "../../spec/fixtures/99100026953506421.mrx" )
10+ . unwrap ( )
11+ . next ( )
12+ . unwrap ( )
13+ . unwrap ( ) ;
14+ let expected = AuthorRoles {
15+ editors : vec ! [ "Nakanishi, Naoki" . to_string( ) ] ,
16+ ..Default :: default ( )
17+ } ;
18+ c. bench_function ( "author_roles" , |b| {
19+ b. iter ( || {
20+ assert_eq ! ( AuthorRoles :: from( & record) , expected) ;
21+ } )
22+ } ) ;
23+ }
24+
525fn genre_facet_benchmark ( c : & mut Criterion ) {
626 let record = Record :: from_xml_file ( "../../spec/fixtures/99100026953506421.mrx" )
727 . unwrap ( )
@@ -31,5 +51,10 @@ fn call_number_benchmark(c: &mut Criterion) {
3151 } ) ;
3252}
3353
34- criterion_group ! ( benches, genre_facet_benchmark, call_number_benchmark) ;
54+ criterion_group ! (
55+ benches,
56+ author_role_benchmark,
57+ call_number_benchmark,
58+ genre_facet_benchmark
59+ ) ;
3560criterion_main ! ( benches) ;
You can’t perform that action at this time.
0 commit comments