{"action":"created","issue":{"url":"https://api.github.com/repos/flux-framework/flux-core/issues/833","repository_url":"https://api.github.com/repos/flux-framework/flux-core","labels_url":"https://api.github.com/repos/flux-framework/flux-core/issues/833/labels{/name}","comments_url":"https://api.github.com/repos/flux-framework/flux-core/issues/833/comments","events_url":"https://api.github.com/repos/flux-framework/flux-core/issues/833/events","html_url":"https://github.com/flux-framework/flux-core/pull/833","id":181035177,"number":833,"title":"small experiment with cJSON","user":{"login":"garlick","id":169947,"avatar_url":"https://avatars.githubusercontent.com/u/169947?v=3","gravatar_id":"","url":"https://api.github.com/users/garlick","html_url":"https://github.com/garlick","followers_url":"https://api.github.com/users/garlick/followers","following_url":"https://api.github.com/users/garlick/following{/other_user}","gists_url":"https://api.github.com/users/garlick/gists{/gist_id}","starred_url":"https://api.github.com/users/garlick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garlick/subscriptions","organizations_url":"https://api.github.com/users/garlick/orgs","repos_url":"https://api.github.com/users/garlick/repos","events_url":"https://api.github.com/users/garlick/events{/privacy}","received_events_url":"https://api.github.com/users/garlick/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/flux-framework/flux-core/labels/review","name":"review","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-05T00:03:12Z","updated_at":"2016-10-05T17:48:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/flux-framework/flux-core/pulls/833","html_url":"https://github.com/flux-framework/flux-core/pull/833","diff_url":"https://github.com/flux-framework/flux-core/pull/833.diff","patch_url":"https://github.com/flux-framework/flux-core/pull/833.patch"},"body":"The [cJSON](https://github.com/DaveGamble/cJSON) library is small, embeddable, reasonably fast (see [JSON benchmarks](https://github.com/miloyip/nativejson-benchmark)), and seems widely used.  It implements \"JSON patch\", as described in [RFC 6902](https://tools.ietf.org/html/rfc6902) which may have applications in the KVS, perhaps as a replacement for the ad-hoc \"operation\" array in the commit request.  I'm curious whether switching to cJSON might not be a useful idea in the KVS internally, particularly if \"JSON patch\" can be used there.  I'm also wondering if this API might be a little nicer than json-c.\r\n\r\nIn this PR, I embedded the library in flux-core and converted `flux-kvs` to use it as an experiment.  So far, well...not too bad I guess.  A couple of interesting bits relative to json-c:\r\n* It allows malloc/free functions to be registered by the user\r\n* it is not refcounted (I'm not sure if that as good or bad at this point!)\r\n* it only implements the \"number\" type, not int, int64, and double like json-c.\r\n* no name collisions with json-c (unlike jansson) so it doesn't require all or nothing investment\r\n\r\nSome problems noted so far\r\n* code is nearly unreadable (e.g. needs to be reformatted IMHO)\r\n* malloc/free pointers are stored in globals which might not work for broker/modules (move to TLS?)\r\n* if you don't register a \"fatal\" malloc/free, checking for ENOMEM is a bit tricky (e.g. checking for NULL structure members - requires peeking at source)\r\n\r\nNot for merging - just a checkpoint."},"comment":{"url":"https://api.github.com/repos/flux-framework/flux-core/issues/comments/251747499","html_url":"https://github.com/flux-framework/flux-core/pull/833#issuecomment-251747499","issue_url":"https://api.github.com/repos/flux-framework/flux-core/issues/833","id":251747499,"user":{"login":"garlick","id":169947,"avatar_url":"https://avatars.githubusercontent.com/u/169947?v=3","gravatar_id":"","url":"https://api.github.com/users/garlick","html_url":"https://github.com/garlick","followers_url":"https://api.github.com/users/garlick/followers","following_url":"https://api.github.com/users/garlick/following{/other_user}","gists_url":"https://api.github.com/users/garlick/gists{/gist_id}","starred_url":"https://api.github.com/users/garlick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garlick/subscriptions","organizations_url":"https://api.github.com/users/garlick/orgs","repos_url":"https://api.github.com/users/garlick/repos","events_url":"https://api.github.com/users/garlick/events{/privacy}","received_events_url":"https://api.github.com/users/garlick/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T17:48:02Z","updated_at":"2016-10-05T17:48:02Z","body":"Looks like code reformatting is in the queue upstream, see DaveGamble/cJSON#24\r\n\r\n"}}
{"actor":{"display_login":"garlick"}}