Good news for yaml, but still very slow, because yaml is too comlex.
In example, i converted yaml samples to tree format 
(https://github.com/nin-jin/node-jin#tree) with type hints (date, number, 
link to subtree, string is default), and compared perfomance. 

=======================================================
TreeSample: scalar_double_quoted_binary_01.tree (*203* characters)
 > $.jin.tree            x 527,078 ops/sec ±6.61% (89 runs sampled)
 > $.jin.tree (hints)    x *356,018* ops/sec ±0.48% (99 runs sampled)
Sample: scalar_double_quoted_binary_01.yaml (*808* characters)
 > JS-YAML (new, unsafe) x *26,518* ops/sec ±1.61% (99 runs sampled)

TreeSample: scalar_double_quoted_binary_02.tree (*3010* characters)
 > $.jin.tree            x 56,675 ops/sec ±0.64% (96 runs sampled)
 > $.jin.tree (hints)    x *47,741* ops/sec ±0.36% (98 runs sampled)
Sample: scalar_double_quoted_binary_02.yaml (*12008* characters)
 > JS-YAML (new, unsafe) x *1,878* ops/sec ±0.36% (98 runs sampled)

TreeSample: scalar_double_quoted_escaped_01.tree (109 characters)
 > $.jin.tree            x 728,131 ops/sec ±0.50% (96 runs sampled)
 > $.jin.tree (hints)    x *437,148* ops/sec ±0.51% (97 runs sampled)
Sample: scalar_double_quoted_escaped_01.yaml (120 characters)
 > JS-YAML (new, unsafe) x *260,019* ops/sec ±0.52% (96 runs sampled)

TreeSample: scalar_double_quoted_escaped_02.tree (3366 characters)
 > $.jin.tree            x 53,348 ops/sec ±0.40% (98 runs sampled)
 > $.jin.tree (hints)    x *47,360* ops/sec ±0.58% (98 runs sampled)
Sample: scalar_double_quoted_escaped_02.yaml (3445 characters)
 > JS-YAML (new, unsafe) x *16,388* ops/sec ±0.54% (98 runs sampled)

TreeSample: scalar_double_quoted_simple_01.tree (105 characters)
 > $.jin.tree            x 898,576 ops/sec ±0.56% (95 runs sampled)
 > $.jin.tree (hints)    x *584,241* ops/sec ±0.62% (95 runs sampled)
Sample: scalar_double_quoted_simple_01.yaml (108 characters)
 > JS-YAML (new, unsafe) x *351,948* ops/sec ±0.56% (98 runs sampled)

TreeSample: scalar_double_quoted_simple_02.tree (3351 characters)
 > $.jin.tree            x 139,855 ops/sec ±3.07% (95 runs sampled)
 > $.jin.tree (hints)    x *117,406* ops/sec ±0.91% (94 runs sampled)
Sample: scalar_double_quoted_simple_02.yaml (3354 characters)
 > JS-YAML (new, unsafe) x *19,206* ops/sec ±0.25% (95 runs sampled)

TreeSample: scalar_double_quoted_simple_multiline.tree (2745 characters)
 > $.jin.tree            x 35,306 ops/sec ±1.86% (90 runs sampled)
 > $.jin.tree (hints)    x *31,315* ops/sec ±0.46% (98 runs sampled)
Sample: scalar_double_quoted_simple_multiline.yaml (2748 characters)
 > JS-YAML (old)         x 830 ops/sec ±1.39% (93 runs sampled)
* > YAML.js              :*
* > JS-YAML (new, safe)  :*
* > JS-YAML (new, unsafe):*
=======================================================

I do not optimize tree parser yet :-)
Type hints are simple but powerful, and there is not much penalty, because 
type-hinter processes a simple js-tree and handles specials node names.

See some example of type-hinted tree:

=======================================================
receipt
name  =Oz-Ware Purchase Invoice
date @=2007-08-06
 customer
given   =Dorothy
family  =Gale
 item
part_no   =A4786
descrip   =Water Bucket (Filled)
price    #=1.47
quantity #=4
item
part_no   =E1628
descrip   =High Heeled "Ruby" Slippers
size     #=8
price    #=100.27
quantity #=1
 bill-to
street
=123 Tornado Alley
=Suite 16
city  =East Centerville
state =KS
 ship-to &= receipt / bill-to
 specialDelivery
=Follow the Yellow Brick
=Road to the Emerald City.
=Pay no attention to the
=man behind the curtain.
=======================================================


пятница, 18 января 2013 г., 11:34:23 UTC+4 пользователь Vitaly Puzrin 
написал:
>
> I'd like to boast with rewritten js-yaml, that will be released soon. This 
> work was inspired by mongodb/redis drivers, wich do not require native code 
> anymore.
> Benchmark is here: https://github.com/dervus/js-yaml-benchmark
>
> Sample: application.yml (2055 characters)
>  > JS-YAML (old)         x 357 ops/sec ±3.60% (84 runs sampled)
>  > YAML.js               x 1,326 ops/sec ±0.46% (97 runs sampled)
>  > JS-YAML (new, unsafe) x 12,937 ops/sec ±0.58% (99 runs sampled)
>
>
> Sample: application_big.yml (223996 characters)
>  > JS-YAML (old)         x 1.71 ops/sec ±1.53% (7 runs sampled)
>  > YAML.js               x 12.68 ops/sec ±1.89% (35 runs sampled)
>  > JS-YAML (new, unsafe) x 133 ops/sec ±0.20% (86 runs sampled)
>
>
> Sample: application_verybig_nocomments.yml (277451 characters)
>  > JS-YAML (old)         x 0.10 ops/sec ±0.20% (4 runs sampled)
>  > YAML.js               x 2.61 ops/sec ±1.00% (10 runs sampled)
>  > JS-YAML (new, unsafe) x 45.27 ops/sec ±0.31% (59 runs sampled)
>
>
> 10mb/sec of pure data parce speed, on macbook air. That's certainly ok 
> without libyaml :)
>
> PS. yes, new release will include writer, at last.
>
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to