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

Method parse_file

bench/bench.cpp:819–840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

817 }
818
819 clock_type::duration
820 parse_file(file_item const& fi, std::size_t repeat) const override
821 {
822 using namespace rapidjson;
823
824 auto const start = clock_type::now();
825 char* s = new char[ fi.text.size() ];
826 std::unique_ptr<char[]> holder(s);
827
828 while(repeat--)
829 {
830 FILE* f = fopen(fi.name.data(), "rb");
831 std::size_t const sz = fread(s, 1, fi.text.size(), f);
832
833 Allocator alloc;
834 GenericDocument<UTF8<>, Allocator> d(&alloc);
835 d.template Parse<rapidjson_impl::parse_flags>(s, sz);
836
837 fclose(f);
838 }
839 return clock_type::now() - start;
840 }
841
842 clock_type::duration
843 serialize_string(file_item const& fi, std::size_t repeat) const override

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected