| 566 | } |
| 567 | |
| 568 | clock_type::duration |
| 569 | serialize(file_item const& fi, std::size_t repeat) const override |
| 570 | { |
| 571 | monotonic_resource mr; |
| 572 | storage_ptr sp; |
| 573 | if(is_pool_) |
| 574 | sp = &mr; |
| 575 | value jv = boost::json::parse( fi.text, std::move(sp) ); |
| 576 | data_holder data = construct_data(fi.index, jv); |
| 577 | |
| 578 | auto const start = clock_type::now(); |
| 579 | serializer sr; |
| 580 | string out; |
| 581 | out.reserve(512); |
| 582 | while(repeat--) |
| 583 | { |
| 584 | mpl::mp_with_index<supported_file_count>( |
| 585 | fi.index, convert_to_value{data, jv}); |
| 586 | sr.reset(&jv); |
| 587 | out.clear(); |
| 588 | for(;;) |
| 589 | { |
| 590 | out.grow(sr.read( |
| 591 | out.end(), |
| 592 | out.capacity() - |
| 593 | out.size()).size()); |
| 594 | if(sr.done()) |
| 595 | break; |
| 596 | out.reserve( |
| 597 | out.capacity() + 1); |
| 598 | } |
| 599 | } |
| 600 | return clock_type::now() - start; |
| 601 | } |
| 602 | }; |
| 603 | |
| 604 | class boost_simple_impl : public base_boost_impl |