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

Method serialize_string

bench/bench.cpp:459–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457 }
458
459 clock_type::duration
460 serialize_string(file_item const& fi, std::size_t repeat) const override
461 {
462 monotonic_resource mr;
463 storage_ptr sp;
464 if( is_pool_ )
465 sp = &mr;
466 value jv = json::parse( fi.text, std::move(sp) );
467
468 auto const start = clock_type::now();
469 serializer sr;
470 string out;
471 out.reserve(512);
472 while(repeat--)
473 {
474 sr.reset(&jv);
475 out.clear();
476 for(;;)
477 {
478 out.grow(sr.read(
479 out.end(),
480 out.capacity() -
481 out.size()).size());
482 if(sr.done())
483 break;
484 out.reserve(
485 out.capacity() + 1);
486 }
487 }
488 return clock_type::now() - start;
489 }
490};
491
492//----------------------------------------------------------

Callers

nothing calls this directly

Calls 9

reserveMethod · 0.45
resetMethod · 0.45
clearMethod · 0.45
growMethod · 0.45
sizeMethod · 0.45
readMethod · 0.45
endMethod · 0.45
capacityMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected