MCPcopy Create free account
hub / github.com/boostorg/json / parse_file

Method parse_file

bench/bench.cpp:423–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

finishMethod · 0.80
resetMethod · 0.45
dataMethod · 0.45
writeMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected