caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Simon Cruanes <simon.cruanes.2007@m4x.org>
To: Thomas Gazagnaire <thomas@gazagnaire.org>
Cc: OCaml users <caml-list@inria.fr>
Subject: Re: [Caml-list] [ANN] cconv-0.2
Date: Mon, 1 Dec 2014 11:52:27 +0100	[thread overview]
Message-ID: <20141201105227.GB8862@fuck_yeah> (raw)
In-Reply-To: <591F1716-EE97-4A11-8CFA-A073ED5E64C3@gazagnaire.org>

[-- Attachment #1: Type: text/plain, Size: 2399 bytes --]

Le Mon, 01 Dec 2014, Thomas Gazagnaire a écrit :
> Do you have any benchmarks to compare CConv and similar camlp4 generators?

Hi Thomas,

I hadn't, but I just wrote very basic ones to compare with
ppx_deriving_yojson (should be similar to camlp4). The code is at
https://github.com/c-cube/cconv/blob/e80ab0e6c458a01b419ea69c7f41d0a350aebbad/bench/run_bench.ml

It only compares times for encoding into Json right now, with the
following results (recursive records first, recursive terms then;
"manual" is a handwritten encoding function, "cconv" the combinators
version, and "deriving_yojson" uses @whitequark's nice deriver):

% ./run_bench.native

benchmark points
Throughputs for "manual", "cconv", "deriving_yojson" each running for at least 4 CPU seconds:
         manual:  4.20 WALL ( 4.20 usr +  0.00 sys =  4.20 CPU) @ 3057270.82/s (n=12846652)
          cconv:  4.21 WALL ( 4.21 usr +  0.00 sys =  4.21 CPU) @ 784724.92/s (n=3300553)
deriving_yojson:  4.21 WALL ( 4.21 usr +  0.00 sys =  4.21 CPU) @ 3065779.07/s (n=12891601)
                     Rate           cconv          manual deriving_yojson
          cconv  784725/s              --            -74%            -74%
         manual 3057271/s            290%              --             -0%
deriving_yojson 3065779/s            291%              0%              --

benchmark terms
Throughputs for "manual", "cconv", "deriving_yojson" each running for at least 4 CPU seconds:
         manual:  4.20 WALL ( 4.20 usr +  0.00 sys =  4.20 CPU) @ 1679609.71/s (n=7057720)
          cconv:  4.20 WALL ( 4.20 usr +  0.00 sys =  4.20 CPU) @ 726619.43/s (n=3051075)
deriving_yojson:  4.20 WALL ( 4.20 usr +  0.00 sys =  4.20 CPU) @ 1624740.65/s (n=6822286)
                     Rate           cconv deriving_yojson          manual
          cconv  726619/s              --            -55%            -57%
deriving_yojson 1624741/s            124%              --             -3%
         manual 1679610/s            131%              3%              --


So yeah, unsurprisingly, there is some overhead :(. There is some
dispatching through records-of-functions going on, because combinators
should work with any backend, whereas specialized encoders can build the
result directly.

-- 
Simon

http://weusepgp.info/
key 49AA62B6, fingerprint 949F EB87 8F06 59C6 D7D3  7D8D 4AC0 1D08 49AA 62B6

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-12-01 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01  9:44 Simon Cruanes
2014-12-01 10:15 ` Thomas Gazagnaire
2014-12-01 10:52   ` Simon Cruanes [this message]
2014-12-01 13:00     ` Simon Cruanes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141201105227.GB8862@fuck_yeah \
    --to=simon.cruanes.2007@m4x.org \
    --cc=caml-list@inria.fr \
    --cc=thomas@gazagnaire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).