Is it rapid?
You bet! rapidyaml is hands down the fastest YAML processor, and among the fastest JSON processors. But talk is cheap, so this page shows performance results to substantiate this bold claim.
Linux, gcc 16
This section shows results using gcc 16.1. First, here are some performance plots with an example yaml file using parse and emit benchmarks, comparing ryml with yamlcpp, libyaml and fyaml (click the image to see the data, and see the terminology section at the end for info on the different variants):
| Parse | Emit |
|---|---|
|
To prove that this is not coincidence for a particular
file, here are scatter plots across YAML files with different styles
and sizes, where we pick one of the variants above. The ryml variants
are ryml_yaml_inplace_reuse_reserve and ryml_yaml_str_reserve from
the plots above (again, click the image to see the data):
| Parse | Emit |
|---|---|
|
|
|
|
`
In absolute terms, ryml parses at ~200MB/s and emits at ~600MB/s, and is generally 30x (parse) / 150x (emit) faster than yamlcpp, and never less than 10x (parse) / 50x (emit). These are stark numbers, and justify the library name.
Windows, Visual Studio 2026
Same plots as above (click the image to see the data):
| Parse | Emit |
|---|---|
|
| Parse | Emit |
|---|---|
|
|
|
|
`
JSON performance
ryml is also among the fastest JSON handlers. It may not be the fastest, but is well ahead of the pack; here are some performance results. The benchmark code is the same as above, and it is reading a compile_commands.json file. The json libraries are rapidjson, sajson, jsoncpp and nlohmann:
| Parse performance | Emit performance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
So ryml beats most json parsers at their own game, with the only exception of rapidjson out of the tested libraries. (There are probably other JSON parsers faster than rapidyaml, likely simdjson). As for emitting, rapidyaml is hands-down the fastest, exceeding all JSON libraries tested. Even parsing full YAML is at ~200MB/s, which is still in the JSON performance ballpark, albeit at its lower end. This is something to be proud of, as the YAML specification is much more complex than JSON: 23449 vs 1969 words.
Serialization performance
Serialization speed also matters for overall speed. For
(de)serialization ryml uses the charconv
facilities from
c4core; these functions are
blazing fast, and generally outperform the fastest equivalent
facilities in the standard library by a significant margin. For
example, here are some results for
c4::xtoa<int64_t>():
| gcc 12.1 | Visual Studio 2019 |
|---|---|
Terminology
rapidyaml offers different ways to parse yaml; here’s a legend of the terms used above:
_inplacemeans the source is directly parsed (parse_in_place()orparse_json_in_place())_arenameans the source is first copied to the tree arena and then the copy is parsed (parse_in_arena()orparse_json_in_arena())_reservemeans the target tree or buffer was reserved to a suitable size before parsing / emittingfor parsing:
ryml_yamlmeans the standard ryml tree parser in YAML mode, ie by callingparse_in_arena()orparse_in_place()ryml_jsonmeans the standard ryml tree parser in JSON mode, ie by callingparse_json_in_arena()orparse_json_in_place()ryml_intsmeans the integer events parser_reusemeans the parser or emitter are reused during each benchmark; otherwise they are newly created and destroyed on each benchmark iteration_nofiltermeans scalar filtering was disabled during parsing (seeParseOptions)
for emitting:
ryml_yamlmeans the standard ryml tree emitter in YAML mode, ie by callingemit_yaml()oremitrs_yaml()ryml_jsonmeans the standard ryml tree emitter in YAML mode, ie by callingemit_yaml()oremitrs_json()_strmeans emit to string_filemeans emit toFILE*_str_filemeans emit first to string, then toFILE*(40% faster than_filebecause it results in less system calls)_ostreammeans emit tostd::stringstream_ofstreammeans emit tostd::ofstream













