js_of_ocaml
js_of_ocaml copied to clipboard
Text encode decode
I'd like to benchmark this change
One should create the encoder and the decoder only once and reuse it, and use a fixed buffer for caml_jsstring_of_string.
One should create the encoder and the decoder only once and reuse it, and use a fixed buffer for
caml_jsstring_of_string.
Done
@vouillon, any idea on how to benchmark this other that micro benchmarks ?
A quick micro benchmark show a significant slowdown. master
n: 3, 0.167000 n: 7, 0.268000 n: 10, 0.371000 n: 20, 0.811000 n: 50, 1.989000 n: 100, 3.618000
this PR
n: 3, 1.209000 n: 7, 1.269000 n: 10, 1.354000 n: 20, 1.660000 n: 50, 2.632000 n: 100, 4.578000
@vouillon, do you have any opinion on this ?
A quick micro benchmark show a significant slowdown. master
n: 3, 0.167000 n: 7, 0.268000 n: 10, 0.371000 n: 20, 0.811000 n: 50, 1.989000 n: 100, 3.618000
this PR
n: 3, 1.209000 n: 7, 1.269000 n: 10, 1.354000 n: 20, 1.660000 n: 50, 2.632000 n: 100, 4.578000
Was this slowdown mitigated, or was the end decision to go with it?
Was this slowdown mitigated, or was the end decision to go with it?
The slowdown should only affect non-ascii strings. Also, my assumption was that conversions between js and ml strings should be negligible compared to other computations. Recent bugs found in our previous implementation made me decide to ignore the performance impact and merge this PR
I see. Thanks!