-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace jiffy by jsx #76
Conversation
Hi @BernardNotarianni … I've been under the impression that jiffy is somehow faster or more performant than jsx. Nevertheless I like the fact that jsx requires no hacks to compile. |
@@ -99,14 +99,14 @@ schema(DefinitionName) -> | |||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |||
|
|||
%% @hidden | |||
-spec enc_json(jiffy:json_value()) -> iolist(). | |||
-spec enc_json(jiffy:json_term()) -> iolist(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Dialyzer:
Invalid type specification for function cowboy_swagger:enc_json/1. The success typing is (atom() | binary() | [any()] | number() | {{non_neg_integer(),1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12,1..255},{byte(),byte(),byte()}} | map()) -> binary()
I am extremely convinced that measurable performance gains at runtime trumps having to write (or, to be fair, copy pasting) a couple of overrides in the rebar config. To be honest, I think it's a bad idea to move to a slower alternative to gain a bit of simplicity. If you really want to do this, I would suggest a fork, but I would suggest even more strongly to just use jiffy. However, I am coming from the assumption that jiffy is faster, which I have yet to measure myself. I will run a few benchmarks before giving a definite answer, but I will always side with performance; specially since we can expect the JSON encoding/decoding code to be called at least once per request; if there's any part of a web server that could use an optimization, it's that one. |
IMHO, I think PERFORMANCE shouldn't be a reason to keep using On other hand, I'm not saying we should go for |
I quite agree with remarks from @cabol. Moreover, our priorities are currently :
Hence, in similar context, we would prefer a full erlang lib over the one including parts in C, unless other constraints come in. That's why we chose I do not have stronger cons against If you decide to keep it, I guess we will be happy with our own fork, as swagger is not a critical part of our core. |
@BernardNotarianni we're discussing this internally, but in any case… it would be nice if you can fix that dialyzer warning above :) |
Sure. Sorry about that. |
@elbrujohalcon it looks like I fixed one problem but created a new one 😢 However, I did not find where I could have more information about the errors. Any clue? |
@BernardNotarianni a link to details should appear there… it's a bug in gadget. I'll check it out myself. |
…aaaand merged! Thanks @BernardNotarianni ! |
Thank you for you time 😄 |
We are using cowboy-swagger for barrel-db and we would like to remove the dependency to
jiffy
and usejsx
instead.Here is a proposition for this refactoring.
Bernard.