| 421 | } |
| 422 | |
| 423 | clock_type::duration |
| 424 | parse_file(file_item const& fi, std::size_t repeat) const override |
| 425 | { |
| 426 | auto const start = clock_type::now(); |
| 427 | stream_parser p( {}, get_parse_options() ); |
| 428 | char s[ BOOST_JSON_STACK_BUFFER_SIZE]; |
| 429 | while(repeat--) |
| 430 | { |
| 431 | monotonic_resource mr; |
| 432 | storage_ptr sp; |
| 433 | if( is_pool_ ) |
| 434 | sp = &mr; |
| 435 | p.reset( std::move(sp) ); |
| 436 | |
| 437 | FILE* f = fopen(fi.name.data(), "rb"); |
| 438 | |
| 439 | while( true ) |
| 440 | { |
| 441 | std::size_t const sz = fread(s, 1, sizeof(s), f); |
| 442 | if( ferror(f) ) |
| 443 | break; |
| 444 | |
| 445 | p.write(s, sz); |
| 446 | |
| 447 | if( feof(f) ) |
| 448 | break; |
| 449 | } |
| 450 | |
| 451 | p.finish(); |
| 452 | auto jv = p.release(); |
| 453 | |
| 454 | fclose(f); |
| 455 | } |
| 456 | return clock_type::now() - start; |
| 457 | } |
| 458 | |
| 459 | clock_type::duration |
| 460 | serialize_string(file_item const& fi, std::size_t repeat) const override |