<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">For testing JSON parsers/encoders I recommend <a href="https://github.com/nst/JSONTestSuite">https://github.com/nst/JSONTestSuite</a></div>
<div name="messageSignatureSection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
Michał.</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">On 28 Jun 2018, 10:17 +0200, zxq9@zxq9.com, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">On 2018年6月28日木曜日 9時46分10秒 JST you wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">Hi Craig,<br />
<br />
The lib looks interesting, I would like to try it on my projects.<br />
<br />
Few related questions:<br />
1) Do you plan to add tests later on?<br />
2) What do you think about publishing it on hex.pm, so it's easier<br />
to control releases (for those who are using it), maybe rebar3/erlang.mk<br />
can be quite helpful here?<br />
3) Finally, the performance, did you have a chance to make some comparisons?<br /></blockquote>
<br />
Hi, Oleg!<br />
<br />
1- I fuzzed it by running real-world JSON through it, but am not convinced<br />
of the utility of hand-written tests considering how narrow the actual<br />
spec is compared to the variety of real-world illegal JSON out there. I<br />
think the best way to *really* approach testing would be to write a script<br />
that would evaluate its performance against either a bulk dataset stored<br />
for that purpose or (much better) use PropEr.<br />
<br />
I'm open to that, but don't have the time right now. It works for my cases<br />
exactly as I intended, but I'm certainly open to contributions.<br />
<br />
I fully realize my position is heretical.<br />
<br />
<br />
2- If someone wants to push it to hex.pm that would be swell! I don't use<br />
hex.pm in any projects at the moment, so it is a very low priority. Again,<br />
more of a time issue for me than anything. My "extra" time budget wound up<br />
getting spent on making sure the docs came out properly.<br />
<br />
Same as #1, I'm open to that and would love to see it packaged for others<br />
to use in a more simple way -- but it isn't a personal priority for me at<br />
the moment. It will, however, be part of Zomp's default FOSS repository<br />
once I get around to releasing that (so will JSX).<br />
<br />
<br />
3- The only function I benchmarked formally was decode/1. It performed<br />
about 5% (+/- 10) faster than JSX decode/1 -- so for all practical<br />
purposes is the same. The *size* of the output of decode/1 is larger than<br />
JSX when dealing with strings because decode/1 returns strings-as-strings,<br />
not binaries. This is better for some kinds of manipulation, but isn't<br />
very compact.<br />
<br />
binary_decode/1 almost certainly performs a little slower than decode/1<br />
because I didn't implement that in a particularly efficient way. I can<br />
improve it to a comparable speed if that becomes necessary, though.<br />
Anyway, this has not been benchmarked formally, just poked at with<br />
timer:tc/1 a few times (but that isn't a particularly reliable way to<br />
benchmark things).<br />
<br />
I have not benchmarked encode/1 or binary_encode/1 at all, but would be<br />
very surprised if they are meaningfully slower than JSX as the approach<br />
taken is very similar -- the mapping between JSON <=> Erlang types being<br />
the important difference.<br />
<br />
<br />
Nice to hear from you!<br />
<br />
-Craig<br />
_______________________________________________<br />
erlang-questions mailing list<br />
erlang-questions@erlang.org<br />
http://erlang.org/mailman/listinfo/erlang-questions<br /></blockquote>
<div></div>
</div>
</body>
</html>