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