Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Vinnie Falco vinniefalco

🏠
Working from home
Block or report user

Report or block vinniefalco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:407a6ed7f2039ebcdca278437f917f05
inline
std::string
read_file( char const* path, boost::json::error_code& ec )
{
file f;
f.open( path, "r", ec );
if(ec)
return {};
std::string s;
s.resize( f.size() );
View gist:3a3ff03a96379e6969135c547a07f565
inline
std::string
read_file( char const* path )
{
std::string s;
file f( path, "r" );
s.resize(512);
std::size_t len = 0;
for(;;)
{
View gist:7c0e8eb33233d538afd8da6372e989b6
Parse File 1 canada.json (2251060 bytes)
boost(null): 1197ms
boost(null): 1200ms
boost(null): 1195ms
boost(null): 1195ms
boost(null): 1197ms
boost(block): 2074ms
boost(block): 2070ms
boost(block): 2071ms
boost(block): 2123ms
View gist:8c5171831214bd9aaf6cb3274a9e8c5f
Parse File 1 canada.json (2251060 bytes)
boost(null): 1107ms
boost(null): 1107ms
boost(null): 1109ms
boost(null): 1107ms
boost(null): 1108ms
boost(block): 1765ms
boost(block): 1768ms
boost(block): 1768ms
boost(block): 1822ms
View gist:a06c2039ddf89f8eaec345181cad3840
Parse File 1 canada.json (2251060 bytes)
boost(null): 1155ms
boost(null): 1153ms
boost(null): 1157ms
boost(null): 1158ms
boost(null): 1155ms
boost(block): 1827ms
boost(block): 1828ms
boost(block): 1828ms
boost(block): 1880ms
View gist:bde6ccdc46d62819109f18ba284aa0f8
json::value
parse_file( char const* filename )
{
json::error_code ec;
file f;
f.open( filename, "r", ec );
if(ec)
throw json::system_error(ec);
json::parser p;
p.start();
View gist:28c688fcba35c1a8de8e0e4dd97dc8ff
/** Parse JSON.
This function begins or continues parsing the JSON
in the specified buffer. The algorithm processes
characters starting from the beginning until one
of the following conditions is met:
@li All of the characters in the buffer have been
parsed, or
View gist:5ebc4bd5a37a750cfde3bda8da03ad31
json::value
parse_file( char const* filename )
{
json::error_code ec;
auto f = std::fopen( filename, "r" );
if( ! f )
{
ec.assign( errno, json::generic_category() );
throw json::system_error(ec);
}
View gist:f2914abb45500e6d1bca33ab528d870a
//
// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/vinniefalco/json
//
/*
View gist:2b7922fbdb4a543ce2f24ae91b6a2e45
json::value
parse(std::istream& is)
{
json::parser p;
json::error_code ec;
p.start();
do
{
char buf[4096];
is.read(buf, sizeof(buf));
You can’t perform that action at this time.