[llvm-commits] [PATCH] YAML parser.
Manuel Klimek
klimek at google.com
Tue Jan 31 06:40:55 PST 2012
I now ran some benchmarks on a real larger project configuration
(chromium) and found that the YAML parser is about 30% slower than the
JSONParser. Currently I'd say that's not too bad. Will do a more
in-depth review of the code next.
On Tue, Jan 31, 2012 at 2:40 PM, Manuel Klimek <klimek at google.com> wrote:
> One first quick note: the yaml parser seems to use about twice as much
> memory during parsing (at least on my machine the yaml parser gets my
> machine to go into swap stop, while the json parser runs through fine
> when using 1GB test data).
>
> With -memory-limit 100 the json parser uses about 500MB VmPeak while
> the yaml parser has about 1GB VmPeak.
>
> Cheers,
> /Manuel
>
> On Mon, Jan 30, 2012 at 9:08 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
>> Attached is the patch for the YAML parser I've been working on. YAML
>> is a super set of JSON that adds many features that I want for writing
>> tests for lld (the llvm linker) and other places where we use object
>> files.
>>
>> The API is very similar to the existing JSON API, but is not exactly
>> the same as YAML has an extended data model.
>>
>> This parser is slower than the currently existing JSON parser. For
>> files with large scalars, there is almost no difference. For medium
>> scalars, there's a ~2x slowdown. And for small scalars, there's a ~6x
>> slowdown.
>>
>> Here are some performance numbers for {yaml,json}-bench -memory-limit
>> 100 (a 32bit build can't do much more than that :P). Note that for
>> YAML. The Parsing time includes the Tokenizing time.
>>
>> c:\Users\mspencer\Projects\llvm-project\llvm>yaml-bench -memory-limit 100
>> ===-------------------------------------------------------------------------===
>> YAML parser benchmark
>> ===-------------------------------------------------------------------------===
>> Total Execution Time: 5.2104 seconds (5.2185 wall clock)
>>
>> ---User Time--- --System Time-- --User+System-- ---Wall
>> Time--- --- Name ---
>> 2.8392 ( 56.3%) 0.1716 (100.0%) 3.0108 ( 57.8%) 3.0118 (
>> 57.7%) Small Values: Parsing
>> 2.1216 ( 42.1%) 0.0000 ( 0.0%) 2.1216 ( 40.7%) 2.1257 (
>> 40.7%) Small Values: Tokenizing
>> 0.0780 ( 1.5%) 0.0000 ( 0.0%) 0.0780 ( 1.5%) 0.0810 (
>> 1.6%) Small Values: Loop
>> 5.0388 (100.0%) 0.1716 (100.0%) 5.2104 (100.0%) 5.2185 (100.0%) Total
>>
>> ===-------------------------------------------------------------------------===
>> YAML parser benchmark
>> ===-------------------------------------------------------------------------===
>> Total Execution Time: 0.4836 seconds (0.4740 wall clock)
>>
>> ---User Time--- --User+System-- ---Wall Time--- --- Name ---
>> 0.2184 ( 45.2%) 0.2184 ( 45.2%) 0.2200 ( 46.4%) Medium Values: Parsing
>> 0.1716 ( 35.5%) 0.1716 ( 35.5%) 0.1710 ( 36.1%) Medium Values:
>> Tokenizing
>> 0.0936 ( 19.4%) 0.0936 ( 19.4%) 0.0830 ( 17.5%) Medium Values: Loop
>> 0.4836 (100.0%) 0.4836 (100.0%) 0.4740 (100.0%) Total
>>
>> ===-------------------------------------------------------------------------===
>> YAML parser benchmark
>> ===-------------------------------------------------------------------------===
>> Total Execution Time: 0.2496 seconds (0.2480 wall clock)
>>
>> ---User Time--- --User+System-- ---Wall Time--- --- Name ---
>> 0.0780 ( 31.3%) 0.0780 ( 31.3%) 0.0830 ( 33.5%) Large Values: Parsing
>> 0.0936 ( 37.5%) 0.0936 ( 37.5%) 0.0830 ( 33.5%) Large Values: Tokenizing
>> 0.0780 ( 31.3%) 0.0780 ( 31.3%) 0.0820 ( 33.1%) Large Values: Loop
>> 0.2496 (100.0%) 0.2496 (100.0%) 0.2480 (100.0%) Total
>>
>> c:\Users\mspencer\Projects\llvm-project\llvm>json-bench -memory-limit 100
>> ===-------------------------------------------------------------------------===
>> JSON parser benchmark
>> ===-------------------------------------------------------------------------===
>> Total Execution Time: 0.6552 seconds (0.6531 wall clock)
>>
>> ---User Time--- --System Time-- --User+System-- ---Wall
>> Time--- --- Name ---
>> 0.5460 ( 87.5%) 0.0312 (100.0%) 0.5772 ( 88.1%) 0.5721 (
>> 87.6%) Small Values: Parsing
>> 0.0780 ( 12.5%) 0.0000 ( 0.0%) 0.0780 ( 11.9%) 0.0810 (
>> 12.4%) Small Values: Loop
>> 0.6240 (100.0%) 0.0312 (100.0%) 0.6552 (100.0%) 0.6531 (100.0%) Total
>>
>> ===-------------------------------------------------------------------------===
>> JSON parser benchmark
>> ===-------------------------------------------------------------------------===
>> Total Execution Time: 0.1872 seconds (0.1830 wall clock)
>>
>> ---User Time--- --User+System-- ---Wall Time--- --- Name ---
>> 0.1092 ( 58.3%) 0.1092 ( 58.3%) 0.1030 ( 56.3%) Medium Values: Parsing
>> 0.0780 ( 41.7%) 0.0780 ( 41.7%) 0.0800 ( 43.7%) Medium Values: Loop
>> 0.1872 (100.0%) 0.1872 (100.0%) 0.1830 (100.0%) Total
>>
>> ===-------------------------------------------------------------------------===
>> JSON parser benchmark
>> ===-------------------------------------------------------------------------===
>> Total Execution Time: 0.1716 seconds (0.1620 wall clock)
>>
>> ---User Time--- --User+System-- ---Wall Time--- --- Name ---
>> 0.0780 ( 45.5%) 0.0780 ( 45.5%) 0.0810 ( 50.0%) Large Values: Parsing
>> 0.0936 ( 54.5%) 0.0936 ( 54.5%) 0.0810 ( 50.0%) Large Values: Loop
>> 0.1716 (100.0%) 0.1716 (100.0%) 0.1620 (100.0%) Total
>>
>>
>> - Michael Spencer
More information about the llvm-commits
mailing list